diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-06-01 13:34:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-06-01 13:34:35 -0400 |
commit | 1193755ac6328ad240ba987e6ec41d5e8baf0680 (patch) | |
tree | 40bf847d7e3ebaa57b107151d14e6cd1d280cc6d /fs/ceph | |
parent | 4edebed86690eb8db9af3ab85baf4a34e73266cc (diff) | |
parent | 0ef97dcfce4179a2eba046b855ee2f91d6f1b414 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs changes from Al Viro.
"A lot of misc stuff. The obvious groups:
* Miklos' atomic_open series; kills the damn abuse of
->d_revalidate() by NFS, which was the major stumbling block for
all work in that area.
* ripping security_file_mmap() and dealing with deadlocks in the
area; sanitizing the neighborhood of vm_mmap()/vm_munmap() in
general.
* ->encode_fh() switched to saner API; insane fake dentry in
mm/cleancache.c gone.
* assorted annotations in fs (endianness, __user)
* parts of Artem's ->s_dirty work (jff2 and reiserfs parts)
* ->update_time() work from Josef.
* other bits and pieces all over the place.
Normally it would've been in two or three pull requests, but
signal.git stuff had eaten a lot of time during this cycle ;-/"
Fix up trivial conflicts in Documentation/filesystems/vfs.txt (the
'truncate_range' inode method was removed by the VM changes, the VFS
update adds an 'update_time()' method), and in fs/btrfs/ulist.[ch] (due
to sparse fix added twice, with other changes nearby).
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (95 commits)
nfs: don't open in ->d_revalidate
vfs: retry last component if opening stale dentry
vfs: nameidata_to_filp(): don't throw away file on error
vfs: nameidata_to_filp(): inline __dentry_open()
vfs: do_dentry_open(): don't put filp
vfs: split __dentry_open()
vfs: do_last() common post lookup
vfs: do_last(): add audit_inode before open
vfs: do_last(): only return EISDIR for O_CREAT
vfs: do_last(): check LOOKUP_DIRECTORY
vfs: do_last(): make ENOENT exit RCU safe
vfs: make follow_link check RCU safe
vfs: do_last(): use inode variable
vfs: do_last(): inline walk_component()
vfs: do_last(): make exit RCU safe
vfs: split do_lookup()
Btrfs: move over to use ->update_time
fs: introduce inode operation ->update_time
reiserfs: get rid of resierfs_sync_super
reiserfs: mark the superblock as dirty a bit later
...
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/export.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/fs/ceph/export.c b/fs/ceph/export.c index fbb2a643ef10..8e1b60e557b6 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c | |||
@@ -40,38 +40,49 @@ struct ceph_nfs_confh { | |||
40 | u32 parent_name_hash; | 40 | u32 parent_name_hash; |
41 | } __attribute__ ((packed)); | 41 | } __attribute__ ((packed)); |
42 | 42 | ||
43 | static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len, | 43 | /* |
44 | int connectable) | 44 | * The presence of @parent_inode here tells us whether NFS wants a |
45 | * connectable file handle. However, we want to make a connectionable | ||
46 | * file handle unconditionally so that the MDS gets as much of a hint | ||
47 | * as possible. That means we only use @parent_dentry to indicate | ||
48 | * whether nfsd wants a connectable fh, and whether we should indicate | ||
49 | * failure from a too-small @max_len. | ||
50 | */ | ||
51 | static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len, | ||
52 | struct inode *parent_inode) | ||
45 | { | 53 | { |
46 | int type; | 54 | int type; |
47 | struct ceph_nfs_fh *fh = (void *)rawfh; | 55 | struct ceph_nfs_fh *fh = (void *)rawfh; |
48 | struct ceph_nfs_confh *cfh = (void *)rawfh; | 56 | struct ceph_nfs_confh *cfh = (void *)rawfh; |
49 | struct dentry *parent; | ||
50 | struct inode *inode = dentry->d_inode; | ||
51 | int connected_handle_length = sizeof(*cfh)/4; | 57 | int connected_handle_length = sizeof(*cfh)/4; |
52 | int handle_length = sizeof(*fh)/4; | 58 | int handle_length = sizeof(*fh)/4; |
59 | struct dentry *dentry = d_find_alias(inode); | ||
60 | struct dentry *parent; | ||
53 | 61 | ||
54 | /* don't re-export snaps */ | 62 | /* don't re-export snaps */ |
55 | if (ceph_snap(inode) != CEPH_NOSNAP) | 63 | if (ceph_snap(inode) != CEPH_NOSNAP) |
56 | return -EINVAL; | 64 | return -EINVAL; |
57 | 65 | ||
58 | spin_lock(&dentry->d_lock); | 66 | /* if we found an alias, generate a connectable fh */ |
59 | parent = dentry->d_parent; | 67 | if (*max_len >= connected_handle_length && dentry) { |
60 | if (*max_len >= connected_handle_length) { | ||
61 | dout("encode_fh %p connectable\n", dentry); | 68 | dout("encode_fh %p connectable\n", dentry); |
62 | cfh->ino = ceph_ino(dentry->d_inode); | 69 | spin_lock(&dentry->d_lock); |
70 | parent = dentry->d_parent; | ||
71 | cfh->ino = ceph_ino(inode); | ||
63 | cfh->parent_ino = ceph_ino(parent->d_inode); | 72 | cfh->parent_ino = ceph_ino(parent->d_inode); |
64 | cfh->parent_name_hash = ceph_dentry_hash(parent->d_inode, | 73 | cfh->parent_name_hash = ceph_dentry_hash(parent->d_inode, |
65 | dentry); | 74 | dentry); |
66 | *max_len = connected_handle_length; | 75 | *max_len = connected_handle_length; |
67 | type = 2; | 76 | type = 2; |
77 | spin_unlock(&dentry->d_lock); | ||
68 | } else if (*max_len >= handle_length) { | 78 | } else if (*max_len >= handle_length) { |
69 | if (connectable) { | 79 | if (parent_inode) { |
80 | /* nfsd wants connectable */ | ||
70 | *max_len = connected_handle_length; | 81 | *max_len = connected_handle_length; |
71 | type = 255; | 82 | type = 255; |
72 | } else { | 83 | } else { |
73 | dout("encode_fh %p\n", dentry); | 84 | dout("encode_fh %p\n", dentry); |
74 | fh->ino = ceph_ino(dentry->d_inode); | 85 | fh->ino = ceph_ino(inode); |
75 | *max_len = handle_length; | 86 | *max_len = handle_length; |
76 | type = 1; | 87 | type = 1; |
77 | } | 88 | } |
@@ -79,7 +90,6 @@ static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len, | |||
79 | *max_len = handle_length; | 90 | *max_len = handle_length; |
80 | type = 255; | 91 | type = 255; |
81 | } | 92 | } |
82 | spin_unlock(&dentry->d_lock); | ||
83 | return type; | 93 | return type; |
84 | } | 94 | } |
85 | 95 | ||