Whamcloud - gitweb
b=6203,5654
authorgreen <green>
Wed, 27 Apr 2005 17:35:37 +0000 (17:35 +0000)
committergreen <green>
Wed, 27 Apr 2005 17:35:37 +0000 (17:35 +0000)
r=adilger
Release i_sem and i_alloc_sem prior to getting DLM lock in setattr_raw to
avoid lock inversion issues.

lustre/llite/llite_lib.c

index 5130870..8f0af50 100644 (file)
@@ -1102,8 +1102,17 @@ int ll_setattr_raw(struct inode *inode, struct iattr *attr)
                 if (attr->ia_size == 0)
                         ast_flags = LDLM_AST_DISCARD_DATA;
 
+                up(&inode->i_sem);
+                UP_WRITE_I_ALLOC_SEM(inode);
                 rc = ll_extent_lock(NULL, inode, lsm, LCK_PW, &policy, &lockh,
                                     ast_flags);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+                DOWN_WRITE_I_ALLOC_SEM(inode);
+                down(&inode->i_sem);
+#else
+                down(&inode->i_sem);
+                DOWN_WRITE_I_ALLOC_SEM(inode);
+#endif
                 if (rc != 0)
                         RETURN(rc);