summaryrefslogtreecommitdiffstats
path: root/fs/ceph/mds_client.c
diff options
context:
space:
mode:
authorGreg Farnum2010-08-03 00:34:23 +0200
committerSage Weil2010-08-03 01:10:53 +0200
commit40819f6fb227c1832935b775ac22aef10aa6f6dd (patch)
tree14f3e73f9585cc157ab2daab487c7b3964394fe2 /fs/ceph/mds_client.c
parentceph: define on-wire types, constants for file locking support (diff)
downloadkernel-qcow2-linux-40819f6fb227c1832935b775ac22aef10aa6f6dd.tar.gz
kernel-qcow2-linux-40819f6fb227c1832935b775ac22aef10aa6f6dd.tar.xz
kernel-qcow2-linux-40819f6fb227c1832935b775ac22aef10aa6f6dd.zip
ceph: add flock/fcntl lock support
Implement flock inode operation to support advisory file locking. All lock/unlock operations are synchronous with the MDS. Lock state is sent when reconnecting to a recovering MDS to restore the shared lock state. Signed-off-by: Greg Farnum <gregf@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/mds_client.c')
-rw-r--r--fs/ceph/mds_client.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 615f720a819d..9f0833e1631a 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -3,6 +3,7 @@
#include <linux/wait.h>
#include <linux/slab.h>
#include <linux/sched.h>
+#include <linux/smp_lock.h>
#include "mds_client.h"
#include "mon_client.h"
@@ -2335,7 +2336,22 @@ static int encode_caps_cb(struct inode *inode, struct ceph_cap *cap,
}
spin_unlock(&inode->i_lock);
- err = ceph_pagelist_append(pagelist, &rec, reclen);
+ if (recon_state->flock) {
+ int num_fcntl_locks, num_flock_locks;
+
+ lock_kernel();
+ ceph_count_locks(inode, &num_fcntl_locks, &num_flock_locks);
+ rec.v2.flock_len = (2*sizeof(u32) +
+ (num_fcntl_locks+num_flock_locks) *
+ sizeof(struct ceph_filelock));
+
+ err = ceph_pagelist_append(pagelist, &rec, reclen);
+ if (!err)
+ err = ceph_encode_locks(inode, pagelist,
+ num_fcntl_locks,
+ num_flock_locks);
+ unlock_kernel();
+ }
out:
kfree(path);