Skip to content
Snippets Groups Projects
Commit 9351cb86 authored by Oleg Drokin's avatar Oleg Drokin
Browse files

b=12790

r=wangdi,adilger,huangwei

Release flock locks in liblustre on file close
parent d72e9f75
No related branches found
No related tags found
No related merge requests found
...@@ -89,6 +89,12 @@ Frequency : only for Cray XT3 ...@@ -89,6 +89,12 @@ Frequency : only for Cray XT3
Description: peer credits not enough on many OST per OSS systems. Description: peer credits not enough on many OST per OSS systems.
Details : Use new lnet way to add credits as we need those for pings and ASTs Details : Use new lnet way to add credits as we need those for pings and ASTs
Severity : minor
Bugzilla : 12790
Frequency : only with liblustre
Description: Liblustre is not releasing flock locks on file close.
Details : Release flock locks on file close.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
2007-07-30 Cluster File Systems, Inc. <info@clusterfs.com> 2007-07-30 Cluster File Systems, Inc. <info@clusterfs.com>
......
...@@ -402,9 +402,33 @@ int llu_file_release(struct inode *inode) ...@@ -402,9 +402,33 @@ int llu_file_release(struct inode *inode)
int llu_iop_close(struct inode *inode) int llu_iop_close(struct inode *inode)
{ {
int rc; int rc;
struct ldlm_res_id res_id =
{ .name = {llu_i2stat(inode)->st_ino,
(__u64)llu_i2info(inode)->lli_st_generation, LDLM_FLOCK} };
struct lustre_handle lockh = {0};
liblustre_wait_event(0); liblustre_wait_event(0);
/* If we have posix locks on this file - clear all of those */
if (ldlm_lock_match(
class_exp2obd(llu_i2mdcexp(inode))->obd_namespace,
LDLM_FL_BLOCK_GRANTED|LDLM_FL_TEST_LOCK|LDLM_FL_CBPENDING,
&res_id, LDLM_FLOCK, NULL, LCK_PR|LCK_PW, &lockh)) {
struct file_lock lock;
lock.fl_type = F_UNLCK;
lock.fl_flags = FL_POSIX;
lock.fl_start = 0;
lock.fl_end = OFFSET_MAX;
lock.fl_pid = getpid();
lock.fl_notify = NULL;
lock.fl_insert = NULL;
lock.fl_remove = NULL;
lock.fl_owner = NULL;
lock.fl_file = NULL;
llu_file_flock(inode, F_SETLK, &lock);
}
rc = llu_file_release(inode); rc = llu_file_release(inode);
if (rc) { if (rc) {
CERROR("file close error %d\n", rc); CERROR("file close error %d\n", rc);
......
...@@ -189,6 +189,7 @@ int ll_it_open_error(int phase, struct lookup_intent *it); ...@@ -189,6 +189,7 @@ int ll_it_open_error(int phase, struct lookup_intent *it);
struct inode *llu_iget(struct filesys *fs, struct lustre_md *md); struct inode *llu_iget(struct filesys *fs, struct lustre_md *md);
int llu_inode_getattr(struct inode *inode, struct lov_stripe_md *lsm); int llu_inode_getattr(struct inode *inode, struct lov_stripe_md *lsm);
int llu_setattr_raw(struct inode *inode, struct iattr *attr); int llu_setattr_raw(struct inode *inode, struct iattr *attr);
int llu_file_flock(struct inode *ino, int cmd, struct file_lock *file_lock);
extern struct fssw_ops llu_fssw_ops; extern struct fssw_ops llu_fssw_ops;
......
...@@ -1267,9 +1267,7 @@ static int llu_iop_rmdir_raw(struct pnode *pno) ...@@ -1267,9 +1267,7 @@ static int llu_iop_rmdir_raw(struct pnode *pno)
#define FCNTL_FLMASK_INVALID (O_NONBLOCK|O_ASYNC) #define FCNTL_FLMASK_INVALID (O_NONBLOCK|O_ASYNC)
/* refer to ll_file_flock() for details */ /* refer to ll_file_flock() for details */
static int llu_file_flock(struct inode *ino, int llu_file_flock(struct inode *ino, int cmd, struct file_lock *file_lock)
int cmd,
struct file_lock *file_lock)
{ {
struct llu_inode_info *lli = llu_i2info(ino); struct llu_inode_info *lli = llu_i2info(ino);
struct intnl_stat *st = llu_i2stat(ino); struct intnl_stat *st = llu_i2stat(ino);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment