Re: Union mounts and file locks (was Re: [PATCH 14/39] union-mount: Union mounts documentation)

From: J. R. Okajima
Date: Tue Aug 17 2010 - 20:28:43 EST



Valerie Aurora:
> Union mounts behaves this way with locks for the same reason as
> fchmod(), etc. on O_RDONLY file descriptors fails. In-kernel copyup
> only happens before a file descriptor is open. Once it is open, it is
> very difficult to switch the open file with the newly copied up file
> ("very difficult" meaning "Al Viro refuses to even discuss it").

Laugh, laugh, laugh.
But this is one of the major difference between "union in VFS" and
"union as FS". By the union implemented as FS, the file object will be a
virtual one in a virtual FS, and you can switch two real files on the
layers in the virtual object.


> However, fcntl(F_SETLK) on a file opened read-write will behave
> exactly as expected. The question is how many applications call
> fcntl(F_SETLK) on a read-only file descriptor as the first lock
> operation on a file? Of those applications, how many could easily be
> rewritten to open that file descriptor with write permissions?

I don't know.
If users never use such AP or never meet the problem, then there will be
no actual problem.


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/