2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-10-07 14:00:12 -04:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-19 10:47:02 +00:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-07-25 01:48:30 +04:00
|
|
|
|
[PATCH] VFS: Permit filesystem to override root dentry on mount
Extend the get_sb() filesystem operation to take an extra argument that
permits the VFS to pass in the target vfsmount that defines the mountpoint.
The filesystem is then required to manually set the superblock and root dentry
pointers. For most filesystems, this should be done with simple_set_mnt()
which will set the superblock pointer and then set the root dentry to the
superblock's s_root (as per the old default behaviour).
The get_sb() op now returns an integer as there's now no need to return the
superblock pointer.
This patch permits a superblock to be implicitly shared amongst several mount
points, such as can be done with NFS to avoid potential inode aliasing. In
such a case, simple_set_mnt() would not be called, and instead the mnt_root
and mnt_sb would be set directly.
The patch also makes the following changes:
(*) the get_sb_*() convenience functions in the core kernel now take a vfsmount
pointer argument and return an integer, so most filesystems have to change
very little.
(*) If one of the convenience function is not used, then get_sb() should
normally call simple_set_mnt() to instantiate the vfsmount. This will
always return 0, and so can be tail-called from get_sb().
(*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the
dcache upon superblock destruction rather than shrink_dcache_anon().
This is required because the superblock may now have multiple trees that
aren't actually bound to s_root, but that still need to be cleaned up. The
currently called functions assume that the whole tree is rooted at s_root,
and that anonymous dentries are not the roots of trees which results in
dentries being left unculled.
However, with the way NFS superblock sharing are currently set to be
implemented, these assumptions are violated: the root of the filesystem is
simply a dummy dentry and inode (the real inode for '/' may well be
inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries
with child trees.
[*] Anonymous until discovered from another tree.
(*) The documentation has been adjusted, including the additional bit of
changing ext2_* into foo_* in the documentation.
[akpm@osdl.org: convert ipath_fs, do other stuff]
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Nathan Scott <nathans@sgi.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-23 02:02:57 -07:00
|
|
|
|
2010-07-25 01:48:30 +04:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
2010-07-25 01:48:30 +04:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-07-25 01:48:30 +04:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-08-17 21:44:22 -07:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
2006-09-27 01:50:46 -07:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-08-17 21:44:22 -07:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
2008-08-17 21:44:22 -07:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
2008-08-17 21:44:22 -07:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
2009-02-02 15:07:33 -08:00
|
|
|
|
2014-09-09 01:27:23 +09:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
2008-08-17 21:44:22 -07:00
|
|
|
|
2009-02-02 15:07:33 -08:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
2011-07-26 04:30:04 -04:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
2007-02-12 00:55:37 -08:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
2012-01-10 10:20:35 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
2012-01-10 10:20:35 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
2006-06-09 09:34:16 -04:00
|
|
|
|
2012-01-10 10:20:35 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-19 10:47:02 +00:00
|
|
|
|
2012-01-10 10:20:35 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-19 10:47:02 +00:00
|
|
|
|
2012-01-10 10:20:35 -05:00
|
|
|
|
|
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
2012-01-10 10:20:35 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
2012-01-10 10:20:35 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
2012-01-10 10:20:35 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-08-17 21:44:22 -07:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
2008-08-17 21:44:22 -07:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
2008-08-17 21:44:22 -07:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
2008-08-17 21:44:22 -07:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
2008-08-17 21:44:22 -07:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
2008-08-17 21:44:22 -07:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-08-17 21:44:22 -07:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-08-17 21:44:22 -07:00
|
|
|
|
|
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-05-11 20:47:15 -04:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-19 10:47:02 +00:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
2015-02-19 10:47:02 +00:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
2015-02-19 10:47:02 +00:00
|
|
|
|
VFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry)
Convert the following where appropriate:
(1) S_ISLNK(dentry->d_inode) to d_is_symlink(dentry).
(2) S_ISREG(dentry->d_inode) to d_is_reg(dentry).
(3) S_ISDIR(dentry->d_inode) to d_is_dir(dentry). This is actually more
complicated than it appears as some calls should be converted to
d_can_lookup() instead. The difference is whether the directory in
question is a real dir with a ->lookup op or whether it's a fake dir with
a ->d_automount op.
In some circumstances, we can subsume checks for dentry->d_inode not being
NULL into this, provided we the code isn't in a filesystem that expects
d_inode to be NULL if the dirent really *is* negative (ie. if we're going to
use d_inode() rather than d_backing_inode() to get the inode pointer).
Note that the dentry type field may be set to something other than
DCACHE_MISS_TYPE when d_inode is NULL in the case of unionmount, where the VFS
manages the fall-through from a negative dentry to a lower layer. In such a
case, the dentry type of the negative union dentry is set to the same as the
type of the lower dentry.
However, if you know d_inode is not NULL at the call site, then you can use
the d_is_xxx() functions even in a filesystem.
There is one further complication: a 0,0 chardev dentry may be labelled
DCACHE_WHITEOUT_TYPE rather than DCACHE_SPECIAL_TYPE. Strictly, this was
intended for special directory entry types that don't have attached inodes.
The following perl+coccinelle script was used:
use strict;
my @callers;
open($fd, 'git grep -l \'S_IS[A-Z].*->d_inode\' |') ||
die "Can't grep for S_ISDIR and co. callers";
@callers = <$fd>;
close($fd);
unless (@callers) {
print "No matches\n";
exit(0);
}
my @cocci = (
'@@',
'expression E;',
'@@',
'',
'- S_ISLNK(E->d_inode->i_mode)',
'+ d_is_symlink(E)',
'',
'@@',
'expression E;',
'@@',
'',
'- S_ISDIR(E->d_inode->i_mode)',
'+ d_is_dir(E)',
'',
'@@',
'expression E;',
'@@',
'',
'- S_ISREG(E->d_inode->i_mode)',
'+ d_is_reg(E)' );
my $coccifile = "tmp.sp.cocci";
open($fd, ">$coccifile") || die $coccifile;
print($fd "$_\n") || die $coccifile foreach (@cocci);
close($fd);
foreach my $file (@callers) {
chomp $file;
print "Processing ", $file, "\n";
system("spatch", "--sp-file", $coccifile, $file, "--in-place", "--no-show-diff") == 0 ||
die "spatch failed";
}
[AV: overlayfs parts skipped]
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-01-29 12:02:35 +00:00
|
|
|
|
2015-02-19 10:47:02 +00:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
2015-02-19 10:47:02 +00:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-19 10:47:02 +00:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-10-29 20:13:17 +01:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-11-06 10:36:58 -08:00
|
|
|
|
2007-10-29 20:13:17 +01:00
|
|
|
|
|
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-12-20 08:13:05 -08:00
|
|
|
|
2005-07-07 14:37:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|