aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2012-06-15 15:32:04 -0400
committerSage Weil <sage@inktank.com>2012-06-15 15:32:04 -0400
commit9a64e8e0ace51b309fdcff4b4754b3649250382a (patch)
tree1f0d75c196c5ab0408c55ed6cf3a152f1f921e15 /fs/ceph
parentf3dea7edd3d449fe7a6d402c1ce56a294b985261 (diff)
parentf8f5701bdaf9134b1f90e5044a82c66324d2073f (diff)
Merge tag 'v3.5-rc1'
Linux 3.5-rc1 Conflicts: net/ceph/messenger.c
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/export.c32
-rw-r--r--fs/ceph/snap.c2
-rw-r--r--fs/ceph/super.c3
3 files changed, 23 insertions, 14 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
43static 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 */
51static 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
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index f04c0961f993..e5206fc76562 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -331,7 +331,7 @@ static int build_snap_context(struct ceph_snap_realm *realm)
331 331
332 /* alloc new snap context */ 332 /* alloc new snap context */
333 err = -ENOMEM; 333 err = -ENOMEM;
334 if (num > (ULONG_MAX - sizeof(*snapc)) / sizeof(u64)) 334 if (num > (SIZE_MAX - sizeof(*snapc)) / sizeof(u64))
335 goto fail; 335 goto fail;
336 snapc = kzalloc(sizeof(*snapc) + num*sizeof(u64), GFP_NOFS); 336 snapc = kzalloc(sizeof(*snapc) + num*sizeof(u64), GFP_NOFS);
337 if (!snapc) 337 if (!snapc)
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 3663cf0cb073..1e67dd7305a4 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -667,9 +667,8 @@ static struct dentry *open_root_dentry(struct ceph_fs_client *fsc,
667 dout("open_root_inode success\n"); 667 dout("open_root_inode success\n");
668 if (ceph_ino(inode) == CEPH_INO_ROOT && 668 if (ceph_ino(inode) == CEPH_INO_ROOT &&
669 fsc->sb->s_root == NULL) { 669 fsc->sb->s_root == NULL) {
670 root = d_alloc_root(inode); 670 root = d_make_root(inode);
671 if (!root) { 671 if (!root) {
672 iput(inode);
673 root = ERR_PTR(-ENOMEM); 672 root = ERR_PTR(-ENOMEM);
674 goto out; 673 goto out;
675 } 674 }