aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/mds_client.c
diff options
context:
space:
mode:
authorGreg Farnum <gregf@hq.newdream.net>2010-08-02 18:34:23 -0400
committerSage Weil <sage@newdream.net>2010-08-02 19:10:53 -0400
commit40819f6fb227c1832935b775ac22aef10aa6f6dd (patch)
tree14f3e73f9585cc157ab2daab487c7b3964394fe2 /fs/ceph/mds_client.c
parentfbaad9797a761c2d5ff6e755bbb4c046207a1ca2 (diff)
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 @@
3#include <linux/wait.h> 3#include <linux/wait.h>
4#include <linux/slab.h> 4#include <linux/slab.h>
5#include <linux/sched.h> 5#include <linux/sched.h>
6#include <linux/smp_lock.h>
6 7
7#include "mds_client.h" 8#include "mds_client.h"
8#include "mon_client.h" 9#include "mon_client.h"
@@ -2335,7 +2336,22 @@ static int encode_caps_cb(struct inode *inode, struct ceph_cap *cap,
2335 } 2336 }
2336 spin_unlock(&inode->i_lock); 2337 spin_unlock(&inode->i_lock);
2337 2338
2338 err = ceph_pagelist_append(pagelist, &rec, reclen); 2339 if (recon_state->flock) {
2340 int num_fcntl_locks, num_flock_locks;
2341
2342 lock_kernel();
2343 ceph_count_locks(inode, &num_fcntl_locks, &num_flock_locks);
2344 rec.v2.flock_len = (2*sizeof(u32) +
2345 (num_fcntl_locks+num_flock_locks) *
2346 sizeof(struct ceph_filelock));
2347
2348 err = ceph_pagelist_append(pagelist, &rec, reclen);
2349 if (!err)
2350 err = ceph_encode_locks(inode, pagelist,
2351 num_fcntl_locks,
2352 num_flock_locks);
2353 unlock_kernel();
2354 }
2339 2355
2340out: 2356out:
2341 kfree(path); 2357 kfree(path);