diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2005-06-25 11:15:36 -0400 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-06-25 11:15:36 -0400 |
commit | 9f993fe4634b39ca4404ba278053b03f360ec08a (patch) | |
tree | 36e62a3d384fa9c313cacd73b7aea086d7f74e82 /fs | |
parent | 3f2faef00c6af17542ea8672ed7d09367222b2d0 (diff) |
NTFS: 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.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ntfs/ChangeLog | 4 | ||||
-rw-r--r-- | fs/ntfs/aops.c | 16 | ||||
-rw-r--r-- | fs/ntfs/layout.h | 2 |
3 files changed, 17 insertions, 5 deletions
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog index 08c8c04b0216..59ecca4297bb 100644 --- a/fs/ntfs/ChangeLog +++ b/fs/ntfs/ChangeLog | |||
@@ -121,6 +121,10 @@ ToDo/Notes: | |||
121 | - Stamp the transaction log ($UsnJrnl), aka user space journal, if it | 121 | - Stamp the transaction log ($UsnJrnl), aka user space journal, if it |
122 | is active on the volume and we are mounting read-write or remounting | 122 | is active on the volume and we are mounting read-write or remounting |
123 | from read-only to read-write. | 123 | from read-only to read-write. |
124 | - Fix a bug in address space operations error recovery code paths where | ||
125 | if the runlist was not mapped at all and a mapping error occured we | ||
126 | would leave the runlist locked on exit to the function so that the | ||
127 | next access to the same file would try to take the lock and deadlock. | ||
124 | 128 | ||
125 | 2.1.22 - Many bug and race fixes and error handling improvements. | 129 | 2.1.22 - Many bug and race fixes and error handling improvements. |
126 | 130 | ||
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c index 24c46c200337..3f43bfe6184e 100644 --- a/fs/ntfs/aops.c +++ b/fs/ntfs/aops.c | |||
@@ -264,7 +264,8 @@ lock_retry_remap: | |||
264 | goto lock_retry_remap; | 264 | goto lock_retry_remap; |
265 | rl = NULL; | 265 | rl = NULL; |
266 | lcn = err; | 266 | lcn = err; |
267 | } | 267 | } else if (!rl) |
268 | up_read(&ni->runlist.lock); | ||
268 | /* Hard error, zero out region. */ | 269 | /* Hard error, zero out region. */ |
269 | bh->b_blocknr = -1; | 270 | bh->b_blocknr = -1; |
270 | SetPageError(page); | 271 | SetPageError(page); |
@@ -690,7 +691,8 @@ lock_retry_remap: | |||
690 | goto lock_retry_remap; | 691 | goto lock_retry_remap; |
691 | rl = NULL; | 692 | rl = NULL; |
692 | lcn = err; | 693 | lcn = err; |
693 | } | 694 | } else if (!rl) |
695 | up_read(&ni->runlist.lock); | ||
694 | /* Failed to map the buffer, even after retrying. */ | 696 | /* Failed to map the buffer, even after retrying. */ |
695 | bh->b_blocknr = -1; | 697 | bh->b_blocknr = -1; |
696 | ntfs_error(vol->sb, "Failed to write to inode 0x%lx, " | 698 | ntfs_error(vol->sb, "Failed to write to inode 0x%lx, " |
@@ -965,8 +967,11 @@ lock_retry_remap: | |||
965 | if (err2 == -ENOMEM) | 967 | if (err2 == -ENOMEM) |
966 | page_is_dirty = TRUE; | 968 | page_is_dirty = TRUE; |
967 | lcn = err2; | 969 | lcn = err2; |
968 | } else | 970 | } else { |
969 | err2 = -EIO; | 971 | err2 = -EIO; |
972 | if (!rl) | ||
973 | up_read(&ni->runlist.lock); | ||
974 | } | ||
970 | /* Hard error. Abort writing this record. */ | 975 | /* Hard error. Abort writing this record. */ |
971 | if (!err || err == -ENOMEM) | 976 | if (!err || err == -ENOMEM) |
972 | err = err2; | 977 | err = err2; |
@@ -1660,6 +1665,8 @@ lock_retry_remap: | |||
1660 | "not supported yet. " | 1665 | "not supported yet. " |
1661 | "Sorry."); | 1666 | "Sorry."); |
1662 | err = -EOPNOTSUPP; | 1667 | err = -EOPNOTSUPP; |
1668 | if (!rl) | ||
1669 | up_read(&ni->runlist.lock); | ||
1663 | goto err_out; | 1670 | goto err_out; |
1664 | } else if (!is_retry && | 1671 | } else if (!is_retry && |
1665 | lcn == LCN_RL_NOT_MAPPED) { | 1672 | lcn == LCN_RL_NOT_MAPPED) { |
@@ -1674,7 +1681,8 @@ lock_retry_remap: | |||
1674 | goto lock_retry_remap; | 1681 | goto lock_retry_remap; |
1675 | rl = NULL; | 1682 | rl = NULL; |
1676 | lcn = err; | 1683 | lcn = err; |
1677 | } | 1684 | } else if (!rl) |
1685 | up_read(&ni->runlist.lock); | ||
1678 | /* | 1686 | /* |
1679 | * Failed to map the buffer, even after | 1687 | * Failed to map the buffer, even after |
1680 | * retrying. | 1688 | * retrying. |
diff --git a/fs/ntfs/layout.h b/fs/ntfs/layout.h index 03c3e8612e7c..609ad1728ce4 100644 --- a/fs/ntfs/layout.h +++ b/fs/ntfs/layout.h | |||
@@ -936,7 +936,7 @@ typedef struct { | |||
936 | /* 56*/ le64 quota_charged; /* Byte size of the charge to | 936 | /* 56*/ le64 quota_charged; /* Byte size of the charge to |
937 | the quota for all streams of the file. Note: Is | 937 | the quota for all streams of the file. Note: Is |
938 | zero if quotas are disabled. */ | 938 | zero if quotas are disabled. */ |
939 | /* 64*/ USN usn; /* Last update sequence number | 939 | /* 64*/ leUSN usn; /* Last update sequence number |
940 | of the file. This is a direct index into the | 940 | of the file. This is a direct index into the |
941 | transaction log file ($UsnJrnl). It is zero if | 941 | transaction log file ($UsnJrnl). It is zero if |
942 | the usn journal is disabled or this file has | 942 | the usn journal is disabled or this file has |