Re: NFS woes again Was: [linux-usb-devel] USB-related oops in sysfs with linux v2.6.23-rc3-50-g28e8351

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2007-08-23 at 12:36 -0500, Florin Iucha wrote:
> On Thu, Aug 23, 2007 at 10:14:38AM -0700, Bret Towe wrote:
> > this sounds alot like the post i did yesterday titled 'nfs4 hang regression'
> > i tracked it down to commit 3d39c691ff486142dd9aaeac12f553f4476b7a6
> 
> Yes, it certainly does -- all the symptoms match!
> 
> I'm not [alone in] seeing dead keyboards!
> 
> Now, if only somebody could clarify to me the connection between
> the bad NFS4 shooting the keyboard but not the mouse, that would
> be wonderful.
> 
> florin

Could you and Bret please check if the attached patch fixes the hang?

Cheers
  Trond


--- Begin Message ---
We need to ensure that nobody adds anything to nfs_automount_list while we
are killing off the work queue entry, or else nfs_expire_automounts will
simply rearm it, and we hang.

Signed-off-by: Trond Myklebust <[email protected]>
---

 fs/nfs/namespace.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index aea76d0..bcd0777 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -22,6 +22,11 @@ static void nfs_expire_automounts(struct work_struct *work);
 
 LIST_HEAD(nfs_automount_list);
 static DECLARE_DELAYED_WORK(nfs_automount_task, nfs_expire_automounts);
+/*
+ * The following mutex prevents nfs_follow_mountpoint from adding new
+ * entries to nfs_automount_list
+ */
+static DEFINE_MUTEX(nfs_automount_mutex);
 int nfs_mountpoint_expiry_timeout = 500 * HZ;
 
 static struct vfsmount *nfs_do_submount(const struct vfsmount *mnt_parent,
@@ -128,18 +133,21 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
 		goto out_err;
 
 	mntget(mnt);
+	mutex_lock(&nfs_automount_mutex);
 	err = do_add_mount(mnt, nd, nd->mnt->mnt_flags|MNT_SHRINKABLE, &nfs_automount_list);
 	if (err < 0) {
+		mutex_unlock(&nfs_automount_mutex);
 		mntput(mnt);
 		if (err == -EBUSY)
 			goto out_follow;
 		goto out_err;
 	}
+	schedule_delayed_work(&nfs_automount_task, nfs_mountpoint_expiry_timeout);
+	mutex_unlock(&nfs_automount_mutex);
 	mntput(nd->mnt);
 	dput(nd->dentry);
 	nd->mnt = mnt;
 	nd->dentry = dget(mnt->mnt_root);
-	schedule_delayed_work(&nfs_automount_task, nfs_mountpoint_expiry_timeout);
 out:
 	dprintk("%s: done, returned %d\n", __FUNCTION__, err);
 
@@ -175,8 +183,12 @@ static void nfs_expire_automounts(struct work_struct *work)
 
 void nfs_release_automount_timer(void)
 {
+	if (!list_empty(&nfs_automount_list))
+		return;
+	mutex_lock(&nfs_automount_mutex);
 	if (list_empty(&nfs_automount_list))
 		cancel_delayed_work_sync(&nfs_automount_task);
+	mutex_unlock(&nfs_automount_mutex);
 }
 
 /*

--- End Message ---

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux