summaryrefslogtreecommitdiffstats
path: root/fs/bad_inode.c
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2018-11-07 23:04:43 +0100
committerRichard Weinberger <richard@nod.at>2018-12-13 22:18:24 +0100
commite58725d51fa8da9133f3f1c54170aa2e43056b91 (patch)
treef0962af31727da74c8696c140f6b5fb9c69b5451 /fs/bad_inode.c
parente542087701f09418702673631a908429feb3eae0 (diff)
downloadlinux-e58725d51fa8da9133f3f1c54170aa2e43056b91.tar.bz2
ubifs: Handle re-linking of inodes correctly while recovery
UBIFS's recovery code strictly assumes that a deleted inode will never come back, therefore it removes all data which belongs to that inode as soon it faces an inode with link count 0 in the replay list. Before O_TMPFILE this assumption was perfectly fine. With O_TMPFILE it can lead to data loss upon a power-cut. Consider a journal with entries like: 0: inode X (nlink = 0) /* O_TMPFILE was created */ 1: data for inode X /* Someone writes to the temp file */ 2: inode X (nlink = 0) /* inode was changed, xattr, chmod, … */ 3: inode X (nlink = 1) /* inode was re-linked via linkat() */ Upon replay of entry #2 UBIFS will drop all data that belongs to inode X, this will lead to an empty file after mounting. As solution for this problem, scan the replay list for a re-link entry before dropping data. Fixes: 474b93704f32 ("ubifs: Implement O_TMPFILE") Cc: stable@vger.kernel.org Cc: Russell Senior <russell@personaltelco.net> Cc: Rafał Miłecki <zajec5@gmail.com> Reported-by: Russell Senior <russell@personaltelco.net> Reported-by: Rafał Miłecki <zajec5@gmail.com> Tested-by: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/bad_inode.c')
0 files changed, 0 insertions, 0 deletions