]> err.no Git - linux-2.6/commitdiff
NTFS: Fix a bug in address space operations error recovery code paths where
authorAnton Altaparmakov <aia21@cantab.net>
Sat, 25 Jun 2005 15:15:36 +0000 (16:15 +0100)
committerAnton Altaparmakov <aia21@cantab.net>
Sat, 25 Jun 2005 15:15:36 +0000 (16:15 +0100)
      if the runlist was not mapped at all and a mapping error occured we
      would leave the runlist locked on exit to the function so that the
      next access to the same file would try to take the lock and deadlock.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
fs/ntfs/ChangeLog
fs/ntfs/aops.c
fs/ntfs/layout.h

index 08c8c04b0216da5726ba4c8ce9815430be83ec56..59ecca4297bb88677e0d50e4c282d732af68ae22 100644 (file)
@@ -121,6 +121,10 @@ ToDo/Notes:
        - Stamp the transaction log ($UsnJrnl), aka user space journal, if it
          is active on the volume and we are mounting read-write or remounting
          from read-only to read-write.
+       - Fix a bug in address space operations error recovery code paths where
+         if the runlist was not mapped at all and a mapping error occured we
+         would leave the runlist locked on exit to the function so that the
+         next access to the same file would try to take the lock and deadlock.
 
 2.1.22 - Many bug and race fixes and error handling improvements.
 
index 24c46c2003370744470bfb37efd655d5640a4bb8..3f43bfe6184ea2b344b426313972347b0cf6fb0e 100644 (file)
@@ -264,7 +264,8 @@ lock_retry_remap:
                                        goto lock_retry_remap;
                                rl = NULL;
                                lcn = err;
-                       }
+                       } else if (!rl)
+                               up_read(&ni->runlist.lock);
                        /* Hard error, zero out region. */
                        bh->b_blocknr = -1;
                        SetPageError(page);
@@ -690,7 +691,8 @@ lock_retry_remap:
                                goto lock_retry_remap;
                        rl = NULL;
                        lcn = err;
-               }
+               } else if (!rl)
+                       up_read(&ni->runlist.lock);
                /* Failed to map the buffer, even after retrying. */
                bh->b_blocknr = -1;
                ntfs_error(vol->sb, "Failed to write to inode 0x%lx, "
@@ -965,8 +967,11 @@ lock_retry_remap:
                                        if (err2 == -ENOMEM)
                                                page_is_dirty = TRUE;
                                        lcn = err2;
-                               } else
+                               } else {
                                        err2 = -EIO;
+                                       if (!rl)
+                                               up_read(&ni->runlist.lock);
+                               }
                                /* Hard error.  Abort writing this record. */
                                if (!err || err == -ENOMEM)
                                        err = err2;
@@ -1660,6 +1665,8 @@ lock_retry_remap:
                                                        "not supported yet. "
                                                        "Sorry.");
                                        err = -EOPNOTSUPP;
+                                       if (!rl)
+                                               up_read(&ni->runlist.lock);
                                        goto err_out;
                                } else if (!is_retry &&
                                                lcn == LCN_RL_NOT_MAPPED) {
@@ -1674,7 +1681,8 @@ lock_retry_remap:
                                                goto lock_retry_remap;
                                        rl = NULL;
                                        lcn = err;
-                               }
+                               } else if (!rl)
+                                       up_read(&ni->runlist.lock);
                                /*
                                 * Failed to map the buffer, even after
                                 * retrying.
index 03c3e8612e7c41f2e27b4a9ca0ec485a36b33d9b..609ad1728ce4c74cb14531ad77438b06aefef4f0 100644 (file)
@@ -936,7 +936,7 @@ typedef struct {
                /* 56*/ le64 quota_charged;     /* Byte size of the charge to
                                the quota for all streams of the file. Note: Is
                                zero if quotas are disabled. */
-               /* 64*/ USN usn;                /* Last update sequence number
+               /* 64*/ leUSN usn;              /* Last update sequence number
                                of the file.  This is a direct index into the
                                transaction log file ($UsnJrnl).  It is zero if
                                the usn journal is disabled or this file has