Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd1c9057 authored by Sage Weil's avatar Sage Weil
Browse files

ceph: make lease code DN specific



The lease code includes a mask in the CEPH_LOCK_* namespace, but that
namespace is changing, and only one mask (formerly _DN == 1) is used, so
hard code for that value for now.

If we ever extend this code to handle leases over different data types we
can extend it accordingly.

Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent 7e34bc52
Loading
Loading
Loading
Loading
+11 −10
Original line number Original line Diff line number Diff line
@@ -265,16 +265,17 @@ extern const char *ceph_mds_state_name(int s);
 *  - they also define the lock ordering by the MDS
 *  - they also define the lock ordering by the MDS
 *  - a few of these are internal to the mds
 *  - a few of these are internal to the mds
 */
 */
#define CEPH_LOCK_DN          1
#define CEPH_LOCK_DVERSION    1
#define CEPH_LOCK_ISNAP       2
#define CEPH_LOCK_DN          2
#define CEPH_LOCK_IVERSION    4     /* mds internal */
#define CEPH_LOCK_ISNAP       16
#define CEPH_LOCK_IFILE       8     /* mds internal */
#define CEPH_LOCK_IVERSION    32    /* mds internal */
#define CEPH_LOCK_IAUTH       32
#define CEPH_LOCK_IFILE       64
#define CEPH_LOCK_ILINK       64
#define CEPH_LOCK_IAUTH       128
#define CEPH_LOCK_IDFT        128   /* dir frag tree */
#define CEPH_LOCK_ILINK       256
#define CEPH_LOCK_INEST       256   /* mds internal */
#define CEPH_LOCK_IDFT        512   /* dir frag tree */
#define CEPH_LOCK_IXATTR      512
#define CEPH_LOCK_INEST       1024  /* mds internal */
#define CEPH_LOCK_INO         2048  /* immutable inode bits; not a lock */
#define CEPH_LOCK_IXATTR      2048
#define CEPH_LOCK_INO         8192  /* immutable inode bits; not a lock */


/* client_session ops */
/* client_session ops */
enum {
enum {
+2 −2
Original line number Original line Diff line number Diff line
@@ -2541,7 +2541,7 @@ void ceph_mdsc_lease_send_msg(struct ceph_mds_session *session,
		return;
		return;
	lease = msg->front.iov_base;
	lease = msg->front.iov_base;
	lease->action = action;
	lease->action = action;
	lease->mask = cpu_to_le16(CEPH_LOCK_DN);
	lease->mask = cpu_to_le16(1);
	lease->ino = cpu_to_le64(ceph_vino(inode).ino);
	lease->ino = cpu_to_le64(ceph_vino(inode).ino);
	lease->first = lease->last = cpu_to_le64(ceph_vino(inode).snap);
	lease->first = lease->last = cpu_to_le64(ceph_vino(inode).snap);
	lease->seq = cpu_to_le32(seq);
	lease->seq = cpu_to_le32(seq);
@@ -2571,7 +2571,7 @@ void ceph_mdsc_lease_release(struct ceph_mds_client *mdsc, struct inode *inode,


	BUG_ON(inode == NULL);
	BUG_ON(inode == NULL);
	BUG_ON(dentry == NULL);
	BUG_ON(dentry == NULL);
	BUG_ON(mask != CEPH_LOCK_DN);
	BUG_ON(mask == 0);


	/* is dentry lease valid? */
	/* is dentry lease valid? */
	spin_lock(&dentry->d_lock);
	spin_lock(&dentry->d_lock);