aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/ceph/dir.c7
-rw-r--r--fs/ceph/mds_client.c23
-rw-r--r--fs/ceph/snap.c18
-rw-r--r--fs/ceph/super.c1
-rw-r--r--fs/ceph/super.h4
-rw-r--r--fs/ceph/xattr.c1
6 files changed, 23 insertions, 31 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 00894ff9246..f391f1e7541 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -51,8 +51,7 @@ int ceph_init_dentry(struct dentry *dentry)
51 goto out_unlock; 51 goto out_unlock;
52 } 52 }
53 53
54 if (dentry->d_parent == NULL || /* nfs fh_to_dentry */ 54 if (ceph_snap(dentry->d_parent->d_inode) == CEPH_NOSNAP)
55 ceph_snap(dentry->d_parent->d_inode) == CEPH_NOSNAP)
56 d_set_d_op(dentry, &ceph_dentry_ops); 55 d_set_d_op(dentry, &ceph_dentry_ops);
57 else if (ceph_snap(dentry->d_parent->d_inode) == CEPH_SNAPDIR) 56 else if (ceph_snap(dentry->d_parent->d_inode) == CEPH_SNAPDIR)
58 d_set_d_op(dentry, &ceph_snapdir_dentry_ops); 57 d_set_d_op(dentry, &ceph_snapdir_dentry_ops);
@@ -79,7 +78,7 @@ struct inode *ceph_get_dentry_parent_inode(struct dentry *dentry)
79 return NULL; 78 return NULL;
80 79
81 spin_lock(&dentry->d_lock); 80 spin_lock(&dentry->d_lock);
82 if (dentry->d_parent) { 81 if (!IS_ROOT(dentry)) {
83 inode = dentry->d_parent->d_inode; 82 inode = dentry->d_parent->d_inode;
84 ihold(inode); 83 ihold(inode);
85 } 84 }
@@ -1154,7 +1153,7 @@ static void ceph_d_prune(struct dentry *dentry)
1154 dout("ceph_d_prune %p\n", dentry); 1153 dout("ceph_d_prune %p\n", dentry);
1155 1154
1156 /* do we have a valid parent? */ 1155 /* do we have a valid parent? */
1157 if (!dentry->d_parent || IS_ROOT(dentry)) 1156 if (IS_ROOT(dentry))
1158 return; 1157 return;
1159 1158
1160 /* if we are not hashed, we don't affect D_COMPLETE */ 1159 /* if we are not hashed, we don't affect D_COMPLETE */
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 200bc87eceb..a5a735422aa 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -10,6 +10,7 @@
10#include "super.h" 10#include "super.h"
11#include "mds_client.h" 11#include "mds_client.h"
12 12
13#include <linux/ceph/ceph_features.h>
13#include <linux/ceph/messenger.h> 14#include <linux/ceph/messenger.h>
14#include <linux/ceph/decode.h> 15#include <linux/ceph/decode.h>
15#include <linux/ceph/pagelist.h> 16#include <linux/ceph/pagelist.h>
@@ -394,11 +395,7 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc,
394 s->s_seq = 0; 395 s->s_seq = 0;
395 mutex_init(&s->s_mutex); 396 mutex_init(&s->s_mutex);
396 397
397 ceph_con_init(mdsc->fsc->client->msgr, &s->s_con); 398 ceph_con_init(&s->s_con, s, &mds_con_ops, &mdsc->fsc->client->msgr);
398 s->s_con.private = s;
399 s->s_con.ops = &mds_con_ops;
400 s->s_con.peer_name.type = CEPH_ENTITY_TYPE_MDS;
401 s->s_con.peer_name.num = cpu_to_le64(mds);
402 399
403 spin_lock_init(&s->s_gen_ttl_lock); 400 spin_lock_init(&s->s_gen_ttl_lock);
404 s->s_cap_gen = 0; 401 s->s_cap_gen = 0;
@@ -440,7 +437,8 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc,
440 mdsc->sessions[mds] = s; 437 mdsc->sessions[mds] = s;
441 atomic_inc(&s->s_ref); /* one ref to sessions[], one to caller */ 438 atomic_inc(&s->s_ref); /* one ref to sessions[], one to caller */
442 439
443 ceph_con_open(&s->s_con, ceph_mdsmap_get_addr(mdsc->mdsmap, mds)); 440 ceph_con_open(&s->s_con, CEPH_ENTITY_TYPE_MDS, mds,
441 ceph_mdsmap_get_addr(mdsc->mdsmap, mds));
444 442
445 return s; 443 return s;
446 444
@@ -1472,11 +1470,6 @@ retry:
1472 else 1470 else
1473 len += 1 + temp->d_name.len; 1471 len += 1 + temp->d_name.len;
1474 temp = temp->d_parent; 1472 temp = temp->d_parent;
1475 if (temp == NULL) {
1476 rcu_read_unlock();
1477 pr_err("build_path corrupt dentry %p\n", dentry);
1478 return ERR_PTR(-EINVAL);
1479 }
1480 } 1473 }
1481 rcu_read_unlock(); 1474 rcu_read_unlock();
1482 if (len) 1475 if (len)
@@ -1513,12 +1506,6 @@ retry:
1513 if (pos) 1506 if (pos)
1514 path[--pos] = '/'; 1507 path[--pos] = '/';
1515 temp = temp->d_parent; 1508 temp = temp->d_parent;
1516 if (temp == NULL) {
1517 rcu_read_unlock();
1518 pr_err("build_path corrupt dentry\n");
1519 kfree(path);
1520 return ERR_PTR(-EINVAL);
1521 }
1522 } 1509 }
1523 rcu_read_unlock(); 1510 rcu_read_unlock();
1524 if (pos != 0 || read_seqretry(&rename_lock, seq)) { 1511 if (pos != 0 || read_seqretry(&rename_lock, seq)) {
@@ -2531,7 +2518,9 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc,
2531 session->s_state = CEPH_MDS_SESSION_RECONNECTING; 2518 session->s_state = CEPH_MDS_SESSION_RECONNECTING;
2532 session->s_seq = 0; 2519 session->s_seq = 0;
2533 2520
2521 ceph_con_close(&session->s_con);
2534 ceph_con_open(&session->s_con, 2522 ceph_con_open(&session->s_con,
2523 CEPH_ENTITY_TYPE_MDS, mds,
2535 ceph_mdsmap_get_addr(mdsc->mdsmap, mds)); 2524 ceph_mdsmap_get_addr(mdsc->mdsmap, mds));
2536 2525
2537 /* replay unsafe requests */ 2526 /* replay unsafe requests */
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index e5206fc7656..cbb2f54a301 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -296,8 +296,7 @@ static int build_snap_context(struct ceph_snap_realm *realm)
296 struct ceph_snap_realm *parent = realm->parent; 296 struct ceph_snap_realm *parent = realm->parent;
297 struct ceph_snap_context *snapc; 297 struct ceph_snap_context *snapc;
298 int err = 0; 298 int err = 0;
299 int i; 299 u32 num = realm->num_prior_parent_snaps + realm->num_snaps;
300 int num = realm->num_prior_parent_snaps + realm->num_snaps;
301 300
302 /* 301 /*
303 * build parent context, if it hasn't been built. 302 * build parent context, if it hasn't been built.
@@ -321,11 +320,11 @@ static int build_snap_context(struct ceph_snap_realm *realm)
321 realm->cached_context->seq == realm->seq && 320 realm->cached_context->seq == realm->seq &&
322 (!parent || 321 (!parent ||
323 realm->cached_context->seq >= parent->cached_context->seq)) { 322 realm->cached_context->seq >= parent->cached_context->seq)) {
324 dout("build_snap_context %llx %p: %p seq %lld (%d snaps)" 323 dout("build_snap_context %llx %p: %p seq %lld (%u snaps)"
325 " (unchanged)\n", 324 " (unchanged)\n",
326 realm->ino, realm, realm->cached_context, 325 realm->ino, realm, realm->cached_context,
327 realm->cached_context->seq, 326 realm->cached_context->seq,
328 realm->cached_context->num_snaps); 327 (unsigned int) realm->cached_context->num_snaps);
329 return 0; 328 return 0;
330 } 329 }
331 330
@@ -342,6 +341,8 @@ static int build_snap_context(struct ceph_snap_realm *realm)
342 num = 0; 341 num = 0;
343 snapc->seq = realm->seq; 342 snapc->seq = realm->seq;
344 if (parent) { 343 if (parent) {
344 u32 i;
345
345 /* include any of parent's snaps occurring _after_ my 346 /* include any of parent's snaps occurring _after_ my
346 parent became my parent */ 347 parent became my parent */
347 for (i = 0; i < parent->cached_context->num_snaps; i++) 348 for (i = 0; i < parent->cached_context->num_snaps; i++)
@@ -361,8 +362,9 @@ static int build_snap_context(struct ceph_snap_realm *realm)
361 362
362 sort(snapc->snaps, num, sizeof(u64), cmpu64_rev, NULL); 363 sort(snapc->snaps, num, sizeof(u64), cmpu64_rev, NULL);
363 snapc->num_snaps = num; 364 snapc->num_snaps = num;
364 dout("build_snap_context %llx %p: %p seq %lld (%d snaps)\n", 365 dout("build_snap_context %llx %p: %p seq %lld (%u snaps)\n",
365 realm->ino, realm, snapc, snapc->seq, snapc->num_snaps); 366 realm->ino, realm, snapc, snapc->seq,
367 (unsigned int) snapc->num_snaps);
366 368
367 if (realm->cached_context) 369 if (realm->cached_context)
368 ceph_put_snap_context(realm->cached_context); 370 ceph_put_snap_context(realm->cached_context);
@@ -402,9 +404,9 @@ static void rebuild_snap_realms(struct ceph_snap_realm *realm)
402 * helper to allocate and decode an array of snapids. free prior 404 * helper to allocate and decode an array of snapids. free prior
403 * instance, if any. 405 * instance, if any.
404 */ 406 */
405static int dup_array(u64 **dst, __le64 *src, int num) 407static int dup_array(u64 **dst, __le64 *src, u32 num)
406{ 408{
407 int i; 409 u32 i;
408 410
409 kfree(*dst); 411 kfree(*dst);
410 if (num) { 412 if (num) {
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 7076109f014..b982239f38f 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -18,6 +18,7 @@
18#include "super.h" 18#include "super.h"
19#include "mds_client.h" 19#include "mds_client.h"
20 20
21#include <linux/ceph/ceph_features.h>
21#include <linux/ceph/decode.h> 22#include <linux/ceph/decode.h>
22#include <linux/ceph/mon_client.h> 23#include <linux/ceph/mon_client.h>
23#include <linux/ceph/auth.h> 24#include <linux/ceph/auth.h>
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index f4d5522cb61..ebc95cc652b 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -612,9 +612,9 @@ struct ceph_snap_realm {
612 u64 parent_since; /* snapid when our current parent became so */ 612 u64 parent_since; /* snapid when our current parent became so */
613 613
614 u64 *prior_parent_snaps; /* snaps inherited from any parents we */ 614 u64 *prior_parent_snaps; /* snaps inherited from any parents we */
615 int num_prior_parent_snaps; /* had prior to parent_since */ 615 u32 num_prior_parent_snaps; /* had prior to parent_since */
616 u64 *snaps; /* snaps specific to this realm */ 616 u64 *snaps; /* snaps specific to this realm */
617 int num_snaps; 617 u32 num_snaps;
618 618
619 struct ceph_snap_realm *parent; 619 struct ceph_snap_realm *parent;
620 struct list_head children; /* list of child realms */ 620 struct list_head children; /* list of child realms */
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index 785cb3057c9..2c2ae5be990 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -457,6 +457,7 @@ start:
457 for (i = 0; i < numattr; i++) 457 for (i = 0; i < numattr; i++)
458 kfree(xattrs[i]); 458 kfree(xattrs[i]);
459 kfree(xattrs); 459 kfree(xattrs);
460 xattrs = NULL;
460 goto start; 461 goto start;
461 } 462 }
462 err = -EIO; 463 err = -EIO;