oops during nfs4 mount
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · On Sat, 05 Apr 2008 23:31:15 -0400 Trond Myklebust…
Quoted 9 lines · Jeff Layton
Quoted 8 lines
Hmm... Bruce & Jeff,
Doesn't the line
nfs_callback_info.task = NULL;in
nfs_callback_svc()need protection by the BKL?
Quoted 9 lines
Quoted 2 lines
Moving it under the BKL probably won't hurt anything, but isn't it already protected by the
nfs_callback_mutex?AFAICS,
nfs_callback_svc()doesn't (and in fact, can't) take the mutex.The point of the BKL here would be to protect
nfs_callback_downagainst the race wherenfs_callback_svc()terminates early, and clears nfs_callback_info.task.
It also looks like the new lockd code may have a similar race. How about something like this patch against Bruce's tree?
Note that this patch is untested. I'll plan to give it some testing in the next day or two and will post it formally if the basic idea seems OK.
fs/lockd/svc.c +6 -2
@@ -194,11 +194,11 @@ lockd(void *vrqstp)nlmsvc_invalidate_all ();nlm_shutdown_hosts (); -unlock_kernel (); - nlmsvc_task =NULL ; nlmsvc_serv =NULL ; +unlock_kernel (); +/* Exit the RPC thread */ svc_exit_thread (rqstp);
@@ -251,6 +251,7 @@ lockd_up(int proto) /* Maybe add a 'family' option when IPv6 is supported ?? */struct svc_rqst *rqstp;int error =0 ; +lock_kernel ();mutex_lock (&nlmsvc_mutex);/* * Check whether we're already up and running.
@@ -315,6 +316,7 @@ out:if (!error) nlmsvc_users++;mutex_unlock (&nlmsvc_mutex); +unlock_kernel ();return error; }EXPORT_SYMBOL (lockd_up);
@@ -325,6 +327,7 @@ EXPORT_SYMBOL(lockd_up);void lockd_down (void ) { +lock_kernel ();mutex_lock (&nlmsvc_mutex);if (nlmsvc_users) {if (--nlmsvc_users)
@@ -342,6 +345,7 @@ lockd_down(void)kthread_stop (nlmsvc_task); out:mutex_unlock (&nlmsvc_mutex); +unlock_kernel (); }EXPORT_SYMBOL (lockd_down);
fs/nfs/callback.c +1 -1
@@ -84,8 +84,8 @@ nfs_callback_svc(void *vrqstp) }svc_process (rqstp); } -unlock_kernel (); nfs_callback_info.task =NULL ; +unlock_kernel ();svc_exit_thread (rqstp);return 0 ; }
Quoted 52 lines · Jeff Layton
Quoted 11 lines · On Sat, 05 Apr 2008 23:31:15 -0400 Trond Myklebust…
Quoted 9 lines · Jeff Layton
Quoted 8 lines
Hmm... Bruce & Jeff,
Doesn't the line
nfs_callback_info.task = NULL;in
nfs_callback_svc()need protection by the BKL?Quoted 9 lines
Quoted 2 lines
Moving it under the BKL probably won't hurt anything, but isn't it already protected by the
nfs_callback_mutex?AFAICS,
nfs_callback_svc()doesn't (and in fact, can't) take the mutex.The point of the BKL here would be to protect
nfs_callback_downagainst the race wherenfs_callback_svc()terminates early, and clears nfs_callback_info.task.It also looks like the new lockd code may have a similar race. How about something like this patch against Bruce's tree?
Note that this patch is untested. I'll plan to give it some testing in the next day or two and will post it formally if the basic idea seems OK.
Signed-off-by Jeff Layton <[email protected]>fs/lockd/svc.c +2
-2@@ -194,11 +194,11 @@ lockd(void *vrqstp)nlmsvc_invalidate_all ();nlm_shutdown_hosts (); -unlock_kernel (); - nlmsvc_task =NULL ; nlmsvc_serv =NULL ; +unlock_kernel (); +/* Exit the RPC thread */ svc_exit_thread (rqstp);
fs/lockd/svc.c lockd_up(int proto) /* Maybe add a 'family' option when IPv6 is supported ?? */ · line 255
Quoted 5 lines
fs/lockd/svc.c +1
-0@@ -251,6 +251,7 @@ lockd_up(int proto) /* Maybe add a 'family' option when IPv6 is supported ?? */struct svc_rqst *rqstp;int error =0 ; +lock_kernel ();mutex_lock (&nlmsvc_mutex);
Small nit: there's no need to hold the BKL while waiting for the mutex lock, so it would be more efficient to invert these two lines. Ditto for lockd_down().
Quoted 40 lines
fs/lockd/svc.c +3
-0/* * Check whether we're already up and running. @@ -315,6 +316,7 @@ out:if (!error) nlmsvc_users++;mutex_unlock (&nlmsvc_mutex); +unlock_kernel ();return error; }EXPORT_SYMBOL (lockd_up);@@ -325,6 +327,7 @@ EXPORT_SYMBOL(lockd_up);void lockd_down (void ) { +lock_kernel ();mutex_lock (&nlmsvc_mutex);if (nlmsvc_users) {if (--nlmsvc_users)@@ -342,6 +345,7 @@ lockd_down(void)kthread_stop (nlmsvc_task); out:mutex_unlock (&nlmsvc_mutex); +unlock_kernel (); }EXPORT_SYMBOL (lockd_down);fs/nfs/callback.c +1
-1@@ -84,8 +84,8 @@ nfs_callback_svc(void *vrqstp) }svc_process (rqstp); } -unlock_kernel (); nfs_callback_info.task =NULL ; +unlock_kernel ();svc_exit_thread (rqstp);return 0 ; }