Re: [PATCH] NFS: fix client hang due to race condition

From: Andrew Morton
Date: Wed Jul 06 2005 - 16:46:49 EST


Nick Wilson <njw@xxxxxxxx> wrote:
>
> The flags field in struct nfs_inode is protected by the BKL. This patch
> fixes a couple places where the lock is not obtained before changing the
> flags.
>

Yeah, nasty. Well caught.

> }
> invalidate_inode_pages2(mapping);
> + lock_kernel();
> nfsi->flags &= ~NFS_INO_INVALID_DATA;
> + unlock_kernel();

Adding new lock_kernel()s is a bit retro. We might want to use a per-inode
lock for this, or set_bit/clear_bit and friends.

If we choose to use a per-inode lock then it is legal to use inode.i_lock
(coz I said) as long as no locks are nested inside it. i_lock's mandate is
"a general-purpose innermost per-inode lock".
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/