lkml.org 
[lkml]   [2005]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC] atomic create+open
From
Date
to den 06.10.2005 Klokka 19:30 (+0200) skreiv Miklos Szeredi:

> Say you have NFS mount on /mnt and a bind mount over the regular file
> /mnt/foo. You do open("/mnt/foo", O_RDWR | O_CREAT, 0644). How do
> you solve the atomic open case.

> If you open in ->lookup("foo") you will be opening the wrong file,
> unless you want to follow mounts inside ->lookup.

Firstly, if that is the case, then you will have dentries for both the
covered and the covering copies of /mnt/foo. A simple test of
have_submounts() on the dentry will suffice to tell the filesystem.
whether or not it should open the file.

Secondly, Linux doesn't actually allow bind mounts on top of regular
files.

Either one of these two points suffices to resolve the "race".

Cheers,
Trond

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-10-06 19:44    [W:2.175 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site