mirror of https://github.com/torvalds/linux.git
fs/ntfs3: Fix handling of InitializeFileRecordSegment
Make the logic of handling the InitializeFileRecordSegment operation similar to that in windows. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
parent
8b26c8c376
commit
766797c295
|
|
@ -3091,16 +3091,16 @@ static int do_action(struct ntfs_log *log, struct OPEN_ATTR_ENRTY *oe,
|
||||||
inode = ilookup(sbi->sb, rno);
|
inode = ilookup(sbi->sb, rno);
|
||||||
if (inode) {
|
if (inode) {
|
||||||
mi = &ntfs_i(inode)->mi;
|
mi = &ntfs_i(inode)->mi;
|
||||||
} else if (op == InitializeFileRecordSegment) {
|
|
||||||
mi = kzalloc(sizeof(struct mft_inode), GFP_NOFS);
|
|
||||||
if (!mi)
|
|
||||||
return -ENOMEM;
|
|
||||||
err = mi_format_new(mi, sbi, rno, 0, false);
|
|
||||||
if (err)
|
|
||||||
goto out;
|
|
||||||
} else {
|
} else {
|
||||||
/* Read from disk. */
|
/* Read from disk. */
|
||||||
err = mi_get(sbi, rno, &mi);
|
err = mi_get(sbi, rno, &mi);
|
||||||
|
if (err && op == InitializeFileRecordSegment) {
|
||||||
|
mi = kzalloc(sizeof(struct mft_inode),
|
||||||
|
GFP_NOFS);
|
||||||
|
if (!mi)
|
||||||
|
return -ENOMEM;
|
||||||
|
err = mi_format_new(mi, sbi, rno, 0, false);
|
||||||
|
}
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
@ -3109,15 +3109,13 @@ static int do_action(struct ntfs_log *log, struct OPEN_ATTR_ENRTY *oe,
|
||||||
if (op == DeallocateFileRecordSegment)
|
if (op == DeallocateFileRecordSegment)
|
||||||
goto skip_load_parent;
|
goto skip_load_parent;
|
||||||
|
|
||||||
if (InitializeFileRecordSegment != op) {
|
if (rec->rhdr.sign == NTFS_BAAD_SIGNATURE)
|
||||||
if (rec->rhdr.sign == NTFS_BAAD_SIGNATURE)
|
goto dirty_vol;
|
||||||
goto dirty_vol;
|
if (!check_lsn(&rec->rhdr, rlsn))
|
||||||
if (!check_lsn(&rec->rhdr, rlsn))
|
goto out;
|
||||||
goto out;
|
if (!check_file_record(rec, NULL, sbi))
|
||||||
if (!check_file_record(rec, NULL, sbi))
|
goto dirty_vol;
|
||||||
goto dirty_vol;
|
attr = Add2Ptr(rec, roff);
|
||||||
attr = Add2Ptr(rec, roff);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_rec_base(rec) || InitializeFileRecordSegment == op) {
|
if (is_rec_base(rec) || InitializeFileRecordSegment == op) {
|
||||||
rno_base = rno;
|
rno_base = rno;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue