mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	nfs: probe for LOCALIO when v4 client reconnects to server
Introduce nfs_local_probe_async() for the NFS client to initiate if/when it reconnects with server. For NFSv4 it is a simple matter to call nfs_local_probe_async() from nfs4_do_reclaim (during NFSv4 grace). Signed-off-by: Mike Snitzer <snitzer@kernel.org> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
This commit is contained in:
		
							parent
							
								
									779a395189
								
							
						
					
					
						commit
						76d4cb6345
					
				
					 5 changed files with 20 additions and 0 deletions
				
			
		| 
						 | 
					@ -186,6 +186,7 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init)
 | 
				
			||||||
	seqlock_init(&clp->cl_boot_lock);
 | 
						seqlock_init(&clp->cl_boot_lock);
 | 
				
			||||||
	ktime_get_real_ts64(&clp->cl_nfssvc_boot);
 | 
						ktime_get_real_ts64(&clp->cl_nfssvc_boot);
 | 
				
			||||||
	nfs_uuid_init(&clp->cl_uuid);
 | 
						nfs_uuid_init(&clp->cl_uuid);
 | 
				
			||||||
 | 
						INIT_WORK(&clp->cl_local_probe_work, nfs_local_probe_async_work);
 | 
				
			||||||
#endif /* CONFIG_NFS_LOCALIO */
 | 
					#endif /* CONFIG_NFS_LOCALIO */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	clp->cl_principal = "*";
 | 
						clp->cl_principal = "*";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -456,6 +456,8 @@ extern int nfs_wait_bit_killable(struct wait_bit_key *key, int mode);
 | 
				
			||||||
#if IS_ENABLED(CONFIG_NFS_LOCALIO)
 | 
					#if IS_ENABLED(CONFIG_NFS_LOCALIO)
 | 
				
			||||||
/* localio.c */
 | 
					/* localio.c */
 | 
				
			||||||
extern void nfs_local_probe(struct nfs_client *);
 | 
					extern void nfs_local_probe(struct nfs_client *);
 | 
				
			||||||
 | 
					extern void nfs_local_probe_async(struct nfs_client *);
 | 
				
			||||||
 | 
					extern void nfs_local_probe_async_work(struct work_struct *);
 | 
				
			||||||
extern struct nfsd_file *nfs_local_open_fh(struct nfs_client *,
 | 
					extern struct nfsd_file *nfs_local_open_fh(struct nfs_client *,
 | 
				
			||||||
					   const struct cred *,
 | 
										   const struct cred *,
 | 
				
			||||||
					   struct nfs_fh *,
 | 
										   struct nfs_fh *,
 | 
				
			||||||
| 
						 | 
					@ -472,6 +474,7 @@ extern bool nfs_server_is_local(const struct nfs_client *clp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#else /* CONFIG_NFS_LOCALIO */
 | 
					#else /* CONFIG_NFS_LOCALIO */
 | 
				
			||||||
static inline void nfs_local_probe(struct nfs_client *clp) {}
 | 
					static inline void nfs_local_probe(struct nfs_client *clp) {}
 | 
				
			||||||
 | 
					static inline void nfs_local_probe_async(struct nfs_client *clp) {}
 | 
				
			||||||
static inline struct nfsd_file *
 | 
					static inline struct nfsd_file *
 | 
				
			||||||
nfs_local_open_fh(struct nfs_client *clp, const struct cred *cred,
 | 
					nfs_local_open_fh(struct nfs_client *clp, const struct cred *cred,
 | 
				
			||||||
		  struct nfs_fh *fh, struct nfs_file_localio *nfl,
 | 
							  struct nfs_fh *fh, struct nfs_file_localio *nfl,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -193,6 +193,20 @@ void nfs_local_probe(struct nfs_client *clp)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL_GPL(nfs_local_probe);
 | 
					EXPORT_SYMBOL_GPL(nfs_local_probe);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void nfs_local_probe_async_work(struct work_struct *work)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct nfs_client *clp =
 | 
				
			||||||
 | 
							container_of(work, struct nfs_client, cl_local_probe_work);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						nfs_local_probe(clp);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void nfs_local_probe_async(struct nfs_client *clp)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						queue_work(nfsiod_workqueue, &clp->cl_local_probe_work);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL_GPL(nfs_local_probe_async);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline struct nfsd_file *nfs_local_file_get(struct nfsd_file *nf)
 | 
					static inline struct nfsd_file *nfs_local_file_get(struct nfsd_file *nf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return nfs_to->nfsd_file_get(nf);
 | 
						return nfs_to->nfsd_file_get(nf);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1955,6 +1955,7 @@ static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recov
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	rcu_read_unlock();
 | 
						rcu_read_unlock();
 | 
				
			||||||
	nfs4_free_state_owners(&freeme);
 | 
						nfs4_free_state_owners(&freeme);
 | 
				
			||||||
 | 
						nfs_local_probe_async(clp);
 | 
				
			||||||
	if (lost_locks)
 | 
						if (lost_locks)
 | 
				
			||||||
		pr_warn("NFS: %s: lost %d locks\n",
 | 
							pr_warn("NFS: %s: lost %d locks\n",
 | 
				
			||||||
			clp->cl_hostname, lost_locks);
 | 
								clp->cl_hostname, lost_locks);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -131,6 +131,7 @@ struct nfs_client {
 | 
				
			||||||
	struct timespec64	cl_nfssvc_boot;
 | 
						struct timespec64	cl_nfssvc_boot;
 | 
				
			||||||
	seqlock_t		cl_boot_lock;
 | 
						seqlock_t		cl_boot_lock;
 | 
				
			||||||
	nfs_uuid_t		cl_uuid;
 | 
						nfs_uuid_t		cl_uuid;
 | 
				
			||||||
 | 
						struct work_struct	cl_local_probe_work;
 | 
				
			||||||
#endif /* CONFIG_NFS_LOCALIO */
 | 
					#endif /* CONFIG_NFS_LOCALIO */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue