]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: lustre: llite: cancel open lock before closing file
authorJinshan Xiong <jinshan.xiong@intel.com>
Tue, 5 Apr 2016 01:37:00 +0000 (21:37 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Apr 2016 03:47:10 +0000 (20:47 -0700)
In error handling path of ll_lease_open(), och has already been
freed in ll_close_inode_openhandle() so the sequence of cancel
open lock and close open handle need adjusting.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647
Reviewed-on: http://review.whamcloud.com/7346
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/llite/file.c

index 000ea58fbdd66ed5906a7bdbf9f3c5e3a1f2ea50..ac17360922567a37b975cb9eb6db6a03859164c2 100644 (file)
@@ -875,16 +875,19 @@ ll_lease_open(struct inode *inode, struct file *file, fmode_t fmode,
        return och;
 
 out_close:
-       rc2 = ll_close_inode_openhandle(sbi->ll_md_exp, inode, och, NULL);
-       if (rc2)
-               CERROR("Close openhandle returned %d\n", rc2);
-
-       /* cancel open lock */
+       /* Cancel open lock */
        if (it.d.lustre.it_lock_mode != 0) {
                ldlm_lock_decref_and_cancel(&och->och_lease_handle,
                                            it.d.lustre.it_lock_mode);
                it.d.lustre.it_lock_mode = 0;
+               och->och_lease_handle.cookie = 0ULL;
        }
+       rc2 = ll_close_inode_openhandle(sbi->ll_md_exp, inode, och, NULL);
+       if (rc2 < 0)
+               CERROR("%s: error closing file "DFID": %d\n",
+                      ll_get_fsname(inode->i_sb, NULL, 0),
+                      PFID(&ll_i2info(inode)->lli_fid), rc2);
+       och = NULL; /* och has been freed in ll_close_inode_openhandle() */
 out_release_it:
        ll_intent_release(&it);
 out: