ext4: gracefully handle ext4_break_layouts() failure during truncate
authorJan Kara <jack@suse.cz>
Thu, 30 May 2019 15:56:23 +0000 (11:56 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 30 May 2019 15:56:23 +0000 (11:56 -0400)
commitb9c1c26739ec2d4b4fb70207a0a9ad6747e43f4c
treee44011f1c26fc058d77ad968756fde4740c5453b
parentcd6c84d8f0cdc911df435bb075ba22ce3c605b07
ext4: gracefully handle ext4_break_layouts() failure during truncate

ext4_break_layouts() may fail e.g. due to a signal being delivered.
Thus we need to handle its failure gracefully and not by taking the
filesystem down. Currently ext4_break_layouts() failure is rare but it
may become more common once RDMA uses layout leases for handling
long-term page pins for DAX mappings.

To handle the failure we need to move ext4_break_layouts() earlier
during setattr handling before we do hard to undo changes such as
modifying inode size. To be able to do that we also have to move some
other checks which are better done without holding i_mmap_sem earlier.

Reported-and-tested-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/inode.c