Re: [BUG REPORT] General protection fault while discarding extents on XFS on next-20240305

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

 



On Wed, Mar 06, 2024 at 07:36:43AM -0700, Keith Busch wrote:
> On Wed, Mar 06, 2024 at 04:35:09AM -0800, Christoph Hellwig wrote:
> > On Wed, Mar 06, 2024 at 12:49:29PM +0530, Chandan Babu R wrote:
> > > The above *probably* occured because __blkdev_issue_discard() noticed a pending
> > > signal, processed the bio, freed the bio and returned a non-NULL bio pointer
> > > to the caller (i.e. xfs_discard_extents()).
> > > 
> > > xfs_discard_extents() then tries to process the freed bio once again.
> > 
> > Yes, __blkdev_issue_discard really needs to clear *biop to NULL for
> > this case, i.e.:
> > 
> > diff --git a/block/blk-lib.c b/block/blk-lib.c
> > index dc8e35d0a51d6d..26850d4895cdaf 100644
> > --- a/block/blk-lib.c
> > +++ b/block/blk-lib.c
> > @@ -99,6 +99,7 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
> >  		cond_resched();
> >  		if (fatal_signal_pending(current)) {
> >  			await_bio_chain(bio);
> > +			*biop = NULL;
> >  			return -EINTR;
> >  		}
> >  	}
> 
> But everyone who calls this already sets their local bio to NULL by
> default, and __blkdev_issue_discard updates *biop only on success, so
> '*biop' should already be NULL here. ?

Oh my mistake: xfs_discard_extents() does this in a loop and chains
along the previous iteration's bio. Your update is needed and looks
good.




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux