]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/ocfs2/aops.c
Merge remote-tracking branches 'regmap/fix/header' and 'regmap/fix/macro' into regmap...
[karo-tx-linux.git] / fs / ocfs2 / aops.c
index 3a22be483af58216cf2d96140bfaaee891b344ad..c5c5b9748ea3b886d03bdcef6830f39d1b9ca14f 100644 (file)
@@ -1842,6 +1842,16 @@ out_commit:
        ocfs2_commit_trans(osb, handle);
 
 out:
+       /*
+        * The mmapped page won't be unlocked in ocfs2_free_write_ctxt(),
+        * even in case of error here like ENOSPC and ENOMEM. So, we need
+        * to unlock the target page manually to prevent deadlocks when
+        * retrying again on ENOSPC, or when returning non-VM_FAULT_LOCKED
+        * to VM code.
+        */
+       if (wc->w_target_locked)
+               unlock_page(mmap_page);
+
        ocfs2_free_write_ctxt(inode, wc);
 
        if (data_ac) {