Merge tag 'nfs-for-5.18-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 30 Mar 2022 01:55:37 +0000 (18:55 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 30 Mar 2022 01:55:37 +0000 (18:55 -0700)
Pull NFS client updates from Trond Myklebust:
 "Highlights include:

  Features:

   - Switch NFS to use readahead instead of the obsolete readpages.

   - Readdir fixes to improve cacheability of large directories when
     there are multiple readers and writers.

   - Readdir performance improvements when doing a seekdir() immediately
     after opening the directory (common when re-exporting NFS).

   - NFS swap improvements from Neil Brown.

   - Loosen up memory allocation to permit direct reclaim and write back
     in cases where there is no danger of deadlocking the writeback code
     or NFS swap.

   - Avoid sillyrename when the NFSv4 server claims to support the
     necessary features to recover the unlinked but open file after
     reboot.

  Bugfixes:

   - Patch from Olga to add a mount option to control NFSv4.1 session
     trunking discovery, and default it to being off.

   - Fix a lockup in nfs_do_recoalesce().

   - Two fixes for list iterator variables being used when pointing to
     the list head.

   - Fix a kernel memory scribble when reading from a non-socket
     transport in /sys/kernel/sunrpc.

   - Fix a race where reconnecting to a server could leave the TCP
     socket stuck forever in the connecting state.

   - Patch from Neil to fix a shutdown race which can leave the SUNRPC
     transport timer primed after we free the struct xprt itself.

   - Patch from Xin Xiong to fix reference count leaks in the NFSv4.2
     copy offload.

   - Sunrpc patch from Olga to avoid resending a task on an offlined
     transport.

  Cleanups:

   - Patches from Dave Wysochanski to clean up the fscache code"

* tag 'nfs-for-5.18-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (91 commits)
  NFSv4/pNFS: Fix another issue with a list iterator pointing to the head
  NFS: Don't loop forever in nfs_do_recoalesce()
  SUNRPC: Don't return error values in sysfs read of closed files
  SUNRPC: Do not dereference non-socket transports in sysfs
  NFSv4.1: don't retry BIND_CONN_TO_SESSION on session error
  SUNRPC don't resend a task on an offlined transport
  NFS: replace usage of found with dedicated list iterator variable
  SUNRPC: avoid race between mod_timer() and del_timer_sync()
  pNFS/files: Ensure pNFS allocation modes are consistent with nfsiod
  pNFS/flexfiles: Ensure pNFS allocation modes are consistent with nfsiod
  NFSv4/pnfs: Ensure pNFS allocation modes are consistent with nfsiod
  NFS: Avoid writeback threads getting stuck in mempool_alloc()
  NFS: nfsiod should not block forever in mempool_alloc()
  SUNRPC: Make the rpciod and xprtiod slab allocation modes consistent
  SUNRPC: Fix unx_lookup_cred() allocation
  NFS: Fix memory allocation in rpc_alloc_task()
  NFS: Fix memory allocation in rpc_malloc()
  SUNRPC: Improve accuracy of socket ENOBUFS determination
  SUNRPC: Replace internal use of SOCKWQ_ASYNC_NOSPACE
  SUNRPC: Fix socket waits for write buffer space
  ...

1  2 
fs/nfs/file.c
fs/nfs/inode.c
fs/nfs/nfs4state.c
fs/nfs/write.c
include/linux/nfs_fs.h
include/linux/nfs_fs_sb.h
include/linux/sunrpc/xprt.h
include/trace/events/sunrpc.h
net/sunrpc/auth_gss/auth_gss.c
net/sunrpc/xprt.c

diff --cc fs/nfs/file.c
@@@ -514,8 -518,8 +518,8 @@@ static void nfs_swap_deactivate(struct 
  
  const struct address_space_operations nfs_file_aops = {
        .readpage = nfs_readpage,
-       .readpages = nfs_readpages,
+       .readahead = nfs_readahead,
 -      .set_page_dirty = __set_page_dirty_nobuffers,
 +      .dirty_folio = filemap_dirty_folio,
        .writepage = nfs_writepage,
        .writepages = nfs_writepages,
        .write_begin = nfs_write_begin,
diff --cc fs/nfs/inode.c
Simple merge
@@@ -2693,9 -2710,32 +2710,31 @@@ out_drain
  static int nfs4_run_state_manager(void *ptr)
  {
        struct nfs_client *clp = ptr;
+       struct rpc_clnt *cl = clp->cl_rpcclient;
+       while (cl != cl->cl_parent)
+               cl = cl->cl_parent;
  
        allow_signal(SIGKILL);
+ again:
+       set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state);
        nfs4_state_manager(clp);
+       if (atomic_read(&cl->cl_swapper)) {
+               wait_var_event_interruptible(&clp->cl_state,
+                                            test_bit(NFS4CLNT_RUN_MANAGER,
+                                                     &clp->cl_state));
+               if (atomic_read(&cl->cl_swapper) &&
+                   test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state))
+                       goto again;
+               /* Either no longer a swapper, or were signalled */
+       }
+       clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
+       if (refcount_read(&clp->cl_count) > 1 && !signalled() &&
+           test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state) &&
+           !test_and_set_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state))
+               goto again;
        nfs_put_client(clp);
 -      module_put_and_kthread_exit(0);
        return 0;
  }
diff --cc fs/nfs/write.c
Simple merge
@@@ -583,9 -578,9 +578,9 @@@ extern int  nfs_updatepage(struct file 
  extern int nfs_sync_inode(struct inode *inode);
  extern int nfs_wb_all(struct inode *inode);
  extern int nfs_wb_page(struct inode *inode, struct page *page);
 -extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
 +int nfs_wb_folio_cancel(struct inode *inode, struct folio *folio);
  extern int  nfs_commit_inode(struct inode *, int);
- extern struct nfs_commit_data *nfs_commitdata_alloc(bool never_fail);
+ extern struct nfs_commit_data *nfs_commitdata_alloc(void);
  extern void nfs_commit_free(struct nfs_commit_data *data);
  bool nfs_commit_end(struct nfs_mds_commit_info *cinfo);
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge