Re: [PATCH] ext4: Fix deadlock on page reclaim

2019-07-30 Thread Damien Le Moal
Dave, On 2019/07/31 8:48, Dave Chinner wrote: > On Tue, Jul 30, 2019 at 02:06:33AM +, Damien Le Moal wrote: >> If we had a pread_nofs()/pwrite_nofs(), that would work. Or we could define a >> RWF_NORECLAIM flag for pwritev2()/preadv2(). This last one could actually be >> the >> cleanest

Re: [PATCH] ext4: Fix deadlock on page reclaim

2019-07-30 Thread Dave Chinner
On Tue, Jul 30, 2019 at 02:06:33AM +, Damien Le Moal wrote: > If we had a pread_nofs()/pwrite_nofs(), that would work. Or we could define a > RWF_NORECLAIM flag for pwritev2()/preadv2(). This last one could actually be > the > cleanest approach. Clean, yes, but I'm not sure we want to expose

Re: [PATCH] ext4: Fix deadlock on page reclaim

2019-07-29 Thread Damien Le Moal
Andreas, On 2019/07/30 3:40, Andreas Dilger wrote: > On Jul 26, 2019, at 8:59 PM, Damien Le Moal wrote: >> >> On 2019/07/27 7:55, Theodore Y. Ts'o wrote: >>> On Sat, Jul 27, 2019 at 08:44:23AM +1000, Dave Chinner wrote: > > This looks like something that could hit every file systems, so

Re: [PATCH] ext4: Fix deadlock on page reclaim

2019-07-29 Thread Andreas Dilger
On Jul 26, 2019, at 8:59 PM, Damien Le Moal wrote: > > On 2019/07/27 7:55, Theodore Y. Ts'o wrote: >> On Sat, Jul 27, 2019 at 08:44:23AM +1000, Dave Chinner wrote: This looks like something that could hit every file systems, so shouldn't we fix this in common code? We could also

Re: [PATCH] ext4: Fix deadlock on page reclaim

2019-07-28 Thread Damien Le Moal
On 2019/07/29 8:42, Dave Chinner wrote: > On Sat, Jul 27, 2019 at 02:59:59AM +, Damien Le Moal wrote: >> On 2019/07/27 7:55, Theodore Y. Ts'o wrote: >>> On Sat, Jul 27, 2019 at 08:44:23AM +1000, Dave Chinner wrote: > > This looks like something that could hit every file systems, so

Re: [PATCH] ext4: Fix deadlock on page reclaim

2019-07-28 Thread Dave Chinner
On Sat, Jul 27, 2019 at 02:59:59AM +, Damien Le Moal wrote: > On 2019/07/27 7:55, Theodore Y. Ts'o wrote: > > On Sat, Jul 27, 2019 at 08:44:23AM +1000, Dave Chinner wrote: > >>> > >>> This looks like something that could hit every file systems, so > >>> shouldn't we fix this in common code?

Re: [PATCH] ext4: Fix deadlock on page reclaim

2019-07-26 Thread Damien Le Moal
On 2019/07/27 7:55, Theodore Y. Ts'o wrote: > On Sat, Jul 27, 2019 at 08:44:23AM +1000, Dave Chinner wrote: >>> >>> This looks like something that could hit every file systems, so >>> shouldn't we fix this in common code? We could also look into >>> just using memalloc_nofs_save for the page

Re: [PATCH] ext4: Fix deadlock on page reclaim

2019-07-26 Thread Theodore Y. Ts'o
On Sat, Jul 27, 2019 at 08:44:23AM +1000, Dave Chinner wrote: > > > > This looks like something that could hit every file systems, so > > shouldn't we fix this in common code? We could also look into > > just using memalloc_nofs_save for the page cache allocation path > > instead of the

Re: [PATCH] ext4: Fix deadlock on page reclaim

2019-07-26 Thread Dave Chinner
On Thu, Jul 25, 2019 at 04:54:42AM -0700, Christoph Hellwig wrote: > On Thu, Jul 25, 2019 at 06:33:58PM +0900, Damien Le Moal wrote: > > + gfp_t gfp_mask; > > + > > switch (ext4_inode_journal_mode(inode)) { > > case EXT4_INODE_ORDERED_DATA_MODE: > > case

Re: [PATCH] ext4: Fix deadlock on page reclaim

2019-07-25 Thread Damien Le Moal
On 2019/07/25 20:54, Christoph Hellwig wrote: > On Thu, Jul 25, 2019 at 06:33:58PM +0900, Damien Le Moal wrote: >> +gfp_t gfp_mask; >> + >> switch (ext4_inode_journal_mode(inode)) { >> case EXT4_INODE_ORDERED_DATA_MODE: >> case EXT4_INODE_WRITEBACK_DATA_MODE: >> @@ -4019,6

Re: [PATCH] ext4: Fix deadlock on page reclaim

2019-07-25 Thread Andreas Dilger
On Jul 25, 2019, at 5:54 AM, Christoph Hellwig wrote: > > On Thu, Jul 25, 2019 at 06:33:58PM +0900, Damien Le Moal wrote: >> +gfp_t gfp_mask; >> + >> switch (ext4_inode_journal_mode(inode)) { >> case EXT4_INODE_ORDERED_DATA_MODE: >> case EXT4_INODE_WRITEBACK_DATA_MODE: >> @@

Re: [PATCH] ext4: Fix deadlock on page reclaim

2019-07-25 Thread Christoph Hellwig
On Thu, Jul 25, 2019 at 06:33:58PM +0900, Damien Le Moal wrote: > + gfp_t gfp_mask; > + > switch (ext4_inode_journal_mode(inode)) { > case EXT4_INODE_ORDERED_DATA_MODE: > case EXT4_INODE_WRITEBACK_DATA_MODE: > @@ -4019,6 +4019,14 @@ void ext4_set_aops(struct inode *inode) >

[PATCH] ext4: Fix deadlock on page reclaim

2019-07-25 Thread Damien Le Moal
In ext4_[da_]write_begin(), grab_cache_page_write_begin() is being called without GFP_NOFS set for the context. This is considered adequate as any eventual memory reclaim triggered by a page allocation is being done before the transaction handle for the write operation is started. However, with