diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2005-10-04 09:24:21 -0400 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-10-04 09:24:21 -0400 |
commit | 511bea5ea2b2b330e67c9e58ffb5027caebf9052 (patch) | |
tree | 142b89f44ebb15f2db326a246e0eb6c454ade6e7 /fs/ntfs/mft.c | |
parent | 69b41e3c0223bd38cf23e3d8f1385963089fbf22 (diff) |
NTFS: - Change {__,}ntfs_cluster_free() to also take an optional attribute
search context as argument. This allows calling it with the mft
record mapped. Update all callers.
- Fix potential deadlock in ntfs_mft_data_extend_allocation_nolock()
error handling by passing in the active search context when calling
ntfs_cluster_free().
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs/ntfs/mft.c')
-rw-r--r-- | fs/ntfs/mft.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c index 15df34f62038..5577fc6e190f 100644 --- a/fs/ntfs/mft.c +++ b/fs/ntfs/mft.c | |||
@@ -1952,20 +1952,21 @@ restore_undo_alloc: | |||
1952 | NVolSetErrors(vol); | 1952 | NVolSetErrors(vol); |
1953 | return ret; | 1953 | return ret; |
1954 | } | 1954 | } |
1955 | a = ctx->attr; | 1955 | ctx->attr->data.non_resident.highest_vcn = |
1956 | a->data.non_resident.highest_vcn = cpu_to_sle64(old_last_vcn - 1); | 1956 | cpu_to_sle64(old_last_vcn - 1); |
1957 | undo_alloc: | 1957 | undo_alloc: |
1958 | if (ntfs_cluster_free(mft_ni, old_last_vcn, -1) < 0) { | 1958 | if (ntfs_cluster_free(mft_ni, old_last_vcn, -1, ctx) < 0) { |
1959 | ntfs_error(vol->sb, "Failed to free clusters from mft data " | 1959 | ntfs_error(vol->sb, "Failed to free clusters from mft data " |
1960 | "attribute.%s", es); | 1960 | "attribute.%s", es); |
1961 | NVolSetErrors(vol); | 1961 | NVolSetErrors(vol); |
1962 | } | 1962 | } |
1963 | a = ctx->attr; | ||
1963 | if (ntfs_rl_truncate_nolock(vol, &mft_ni->runlist, old_last_vcn)) { | 1964 | if (ntfs_rl_truncate_nolock(vol, &mft_ni->runlist, old_last_vcn)) { |
1964 | ntfs_error(vol->sb, "Failed to truncate mft data attribute " | 1965 | ntfs_error(vol->sb, "Failed to truncate mft data attribute " |
1965 | "runlist.%s", es); | 1966 | "runlist.%s", es); |
1966 | NVolSetErrors(vol); | 1967 | NVolSetErrors(vol); |
1967 | } | 1968 | } |
1968 | if (mp_rebuilt) { | 1969 | if (mp_rebuilt && !IS_ERR(ctx->mrec)) { |
1969 | if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( | 1970 | if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( |
1970 | a->data.non_resident.mapping_pairs_offset), | 1971 | a->data.non_resident.mapping_pairs_offset), |
1971 | old_alen - le16_to_cpu( | 1972 | old_alen - le16_to_cpu( |
@@ -1982,6 +1983,10 @@ undo_alloc: | |||
1982 | } | 1983 | } |
1983 | flush_dcache_mft_record_page(ctx->ntfs_ino); | 1984 | flush_dcache_mft_record_page(ctx->ntfs_ino); |
1984 | mark_mft_record_dirty(ctx->ntfs_ino); | 1985 | mark_mft_record_dirty(ctx->ntfs_ino); |
1986 | } else if (IS_ERR(ctx->mrec)) { | ||
1987 | ntfs_error(vol->sb, "Failed to restore attribute search " | ||
1988 | "context.%s", es); | ||
1989 | NVolSetErrors(vol); | ||
1985 | } | 1990 | } |
1986 | if (ctx) | 1991 | if (ctx) |
1987 | ntfs_attr_put_search_ctx(ctx); | 1992 | ntfs_attr_put_search_ctx(ctx); |