-
Notifications
You must be signed in to change notification settings - Fork 832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
statfs.f_fsid is not unique to a mountpoint #1492
Comments
@therealkenc I noticed something on real Linux at least: Parents cannot be renamed or unlinked if there is a root shell with pwd a subdirectory. It only happens with root shells, not ordinary user shells. Maybe that's another reason why it's not a problem on Linux or other Unices? The error iirc when you try to do it is the "Access Denied: The device or resource is busy" one |
Hence the small print. |
Damn, I knew you were allowed to rename parents out from under files (now look what you've done). Following test case succeeds on Real Linux™, but fails on WSL. Doesn't matter root or otherwise, natch. This is on VolFS but I bet DriveFS fares no better. And all I wanted was a unique ID in
strace on WSL:
strace on Ubuntu:
|
Hmm. Is my last post a manifestation of #1420 or different? If it's a dup please don't lose sight of |
I'll take a look at the f_fsid issue and report back. |
For what it is worth (maybe save you some time), on Real Linux, |
@therealkenc - Unless I'm misinterpreting what you're saying I don't think that even Linux makes the guarantee that if stat.st_dev is different that the statfs.f_fsid must be different. Take /proc and /sys mountpoints: Different st_dev values:
Equal statfs.f_fsid values
|
Interesting. The code in question uses |
Narrowing scope entirely to The code in question is here at line 1039 for what it is worth. It only gets that far in the |
From circa Christmas 2016:
After working with some unrelated WSL filesystem stuff recently, I think it is fair to call the crux of my OP linux-behavior. It is unusual for different |
Right now statfs(2) returns a f_fsid of 0x00000001 for all mount points. This is okay as it goes: "Nobody knows what f_fsid is supposed to contain". There is only an implicit guarantee that (f_fsid, ino) is unique.
However, stat(2) on WSL returns different results for
stat.st_dev
depending on what mount the file resides. Runningstat(1)
on/
gives device0x01
and/home
gives device0x10
on my system.Unfortunately, all Unices (Linux, FreeBSD, OSX) also appear to make the implicit guarantee that if the
stat.st_dev
of a file is different, then thestatfs.f_fsid
of the mount point for the file must also be different. Some filesystem-centric code appears to use this fact to map files to mount points without pathwalking1.Request is to stuff whatever lives in
stat.st_dev
for a given mount point directory that lives in/proc/mounts
(/
,/home
,/root
, etc) into thestatfs.f_fsid
returned for that path.1which is technically problematic because on Unix, parents can be `unlink()ed` and `rename()d` out from under you
The text was updated successfully, but these errors were encountered: