[Bug 1024164] New: btrfs: skip waiting on ordered range for special files
http://bugzilla.suse.com/show_bug.cgi?id=1024164 Bug ID: 1024164 Summary: btrfs: skip waiting on ordered range for special files Classification: openSUSE Product: openSUSE Tumbleweed Version: Current Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Kernel Assignee: jeffm@suse.com Reporter: jeffm@suse.com QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- From: Jeff Mahoney <jeffm@suse.com> Subject: btrfs: skip waiting on ordered range for special files References: bko#100911 In btrfs_evict_inode, we properly truncate the page cache for evicted inodes but then we call btrfs_wait_ordered_range for every inode as well. It's the right thing to do for regular files but results in incorrect behavior for device inodes for block devices. filemap_fdatawrite_range gets called with inode->i_mapping which gets resolved to the block device inode before getting passed to wbc_attach_fdatawrite_inode and ultimately to inode_to_bdi. What happens next depends on whether there's an open file handle associated with the inode. If there is, we write to the block device, which is unexpected behavior. If there isn't, we through normally and inode->i_data is used. We can also end up racing against open/close which can result in crashes when i_mapping points to a block device inode that has been closed. Since there can't be any page cache associated with special file inodes, it's safe to skip the btrfs_wait_ordered_range call entirely and avoid the problem. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=100911 Signed-off-by: Jeff Mahoney <jeffm@suse.com> --- fs/btrfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1024164 http://bugzilla.suse.com/show_bug.cgi?id=1024164#c1 --- Comment #1 from Jeff Mahoney <jeffm@suse.com> --- Created attachment 713272 --> http://bugzilla.suse.com/attachment.cgi?id=713272&action=edit [PATCH] btrfs: skip waiting on ordered range for special files -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com