nfs: Assign incremental lk owner to frames

Signed-off-by: Shehjar Tikoo <shehjart@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>

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
This commit is contained in:
Shehjar Tikoo 2010-06-15 00:39:26 +00:00 committed by Anand V. Avati
parent a8ef67630c
commit 43cdbc3756

View File

@ -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;