On Tue 21-05-19 11:27:32, Ira Weiny wrote: > On Tue, May 21, 2019 at 09:43:58AM +0200, Jan Kara wrote: > > 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-by: "Weiny, Ira" <ira.weiny@xxxxxxxxx> > > Signed-off-by: Jan Kara <jack@xxxxxxx> > > > This fixes the bug I was seeing WRT ext4_break_layouts(). Thanks for the help! > One more NIT comment below. > > > @@ -5627,29 +5644,12 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) > > if (error) { > > if (orphan && inode->i_nlink) > > ext4_orphan_del(NULL, inode); > > - goto err_out; > > + goto out_mmap_sem; > > This goto flows through a second ext4_orphan_del() call which threw me at > first. But I think this is ok. It is OK but unnecessary. I've deleted this ext4_orphan_del() call. Thanks for testing and review! Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR