Re: vfs-scale, general questions

From: J. R. Okajima
Date: Thu Jan 20 2011 - 04:05:36 EST



(Some of mail destinations are removed since this is not nfs specific
anymore.)

Nick Piggin:
> > - getcwd(2) needs d_lock?
> > =A0It acquires rename_lock and then tests whether the pwd is removed by
> > =A0d_unhashed(). If a race condition between vfs_rename_dir() which may
> > =A0unhash/rehash the dentry happens, then getcwd() may return the wrong
> > =A0result due to unprotected d_unhashed() call, I am afraid. rename_lock
> > =A0doesn't help this case.
>
> We have the lock in write mode there, so it should exclude that
> particular race. But I need to take another look at this code I
> think, I'm not sure it's completely right, so I would appreciate reviews.

You might think about the race around d_move, but what I meant is the
race between d_unlinked and unhash/rehash.

- getcwd return -ENOENT when pwd is unhashed.
- vfs_rename_dir()
+ makes the existing target unhashed.
+ FS ->rename() is called, here let's assume an error happened. so the
target dir is surely alive and reachable, nothing have been changed.
+ vfs_rename_dir() rehashes it again.

During this unhashed period, getcwd(2) may be issued.
And I am afraid it may return an error incorrectly.


About other issues, I will reply when I have time.


J. R. Okajima
--
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/