From 43cdbc3756bde8c4c95dd3c3a89c802ec204c847 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Tue, 15 Jun 2010 00:39:26 +0000 Subject: nfs: Assign incremental lk owner to frames Signed-off-by: Shehjar Tikoo Signed-off-by: Anand V. Avati BUG: 960 (Disk space leakage and fs corruption after VMs are vmotion'ed) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=960 --- xlators/nfs/server/src/nfs-fops.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'xlators/nfs') diff --git a/xlators/nfs/server/src/nfs-fops.c b/xlators/nfs/server/src/nfs-fops.c index e7505b5dcdd..512ece90ff8 100644 --- a/xlators/nfs/server/src/nfs-fops.c +++ b/xlators/nfs/server/src/nfs-fops.c @@ -83,6 +83,28 @@ nfs_fop_local_wipe (xlator_t *nfsx, struct nfs_fop_local *l) return; } +pthread_mutex_t ctr = PTHREAD_MUTEX_INITIALIZER; +unsigned int cval = 1; + + +int +nfs_frame_getctr () +{ + int val = 0; + + pthread_mutex_lock (&ctr); + { + if (cval == 0) + cval = 1; + val = cval; + cval++; + } + pthread_mutex_unlock (&ctr); + + return val; +} + + call_frame_t * nfs_create_frame (xlator_t *xl, nfs_user_t *nfu) { @@ -109,6 +131,7 @@ nfs_create_frame (xlator_t *xl, nfs_user_t *nfu) gf_log (GF_NFS, GF_LOG_TRACE, "gid: %d", nfu->gids[x]); frame->root->groups[y] = nfu->gids[x]; } + frame->root->lk_owner = nfs_frame_getctr (); err: return frame; -- cgit