Re: [PATCH 3/3] nfs: Block on write congestion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri 14-06-24 08:56:10, NeilBrown wrote:
> On Thu, 13 Jun 2024, Jan Kara wrote:
> > @@ -698,12 +700,14 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
> >  	struct nfs_pageio_descriptor pgio;
> >  	struct nfs_io_completion *ioc = NULL;
> >  	unsigned int mntflags = NFS_SERVER(inode)->flags;
> > +	struct nfs_server *nfss = NFS_SERVER(inode);
> >  	int priority = 0;
> >  	int err;
> >  
> > -	if (wbc->sync_mode == WB_SYNC_NONE &&
> > -	    NFS_SERVER(inode)->write_congested)
> > -		return 0;
> > +	/* Wait with writeback until write congestion eases */
> > +	if (wbc->sync_mode == WB_SYNC_NONE && nfss->write_congested)
> > +		wait_event(nfss->write_congestion_wait,
> > +			   nfss->write_congested == 0);
> 
> If there is a network problem or the server reboot, this could wait
> indefinitely.  Maybe wait_event_idle() ??
> 
> Is this only called from the writeback thread that is dedicated to this
> fs?  If so that should be fine.  If it can be reached from a user
> processes, then wait_event_killable() might be needed.

Usually yes, but e.g. sync_file_range() can issue writeback that will block
here as well. So I guess wait_event_killable() is a good idea. I'll update
it.

								Honza

-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux