Page MenuHomeFreeBSD

Fix FFS panic on ENXIO.
AbandonedPublic

Authored by trasz on May 9 2017, 8:23 AM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 28 2024, 4:53 AM
Unknown Object (File)
Jan 18 2024, 11:45 AM
Unknown Object (File)
Dec 23 2023, 2:45 AM
Unknown Object (File)
Nov 22 2023, 8:15 AM
Unknown Object (File)
Nov 22 2023, 8:06 AM
Unknown Object (File)
Nov 11 2023, 4:27 AM
Unknown Object (File)
Nov 11 2023, 4:12 AM
Unknown Object (File)
Nov 11 2023, 4:01 AM
Subscribers

Details

Reviewers
kib
mckusick
Summary

Fix FFS panic that happens after the mounted device went away with
softupdates enabled. Backtrace would look like this:

#11 0xffffffff80a50063 in panic (fmt=0xffffffff81c6e7f0 <cnputs_mtx+24> "\004") at /usr/home/trasz/svn-ssh/android/sys/kern/kern_shutdown.c:710
#12 0xffffffff80d05dfe in softdep_deallocate_dependencies (bp=0xfffffe01ea78cc40) at /usr/home/trasz/svn-ssh/android/sys/ufs/ffs/ffs_softdep.c:14257
#13 0xffffffff80af662c in buf_deallocate (bp=0xfffffe01ea78cc40) at /usr/home/trasz/svn-ssh/android/sys/sys/buf.h:429
#14 brelse (bp=0xfffffe01ea78cc40) at /usr/home/trasz/svn-ssh/android/sys/kern/vfs_bio.c:2318
#15 0xffffffff80b14b57 in flushbuflist (bufv=<optimized out>, flags=<optimized out>, bo=<optimized out>, slpflag=<optimized out>, slptimeo=0) at /usr/home/trasz/svn-ssh/android/sys/kern/vfs_subr.c:1779
#16 0xffffffff80b147af in bufobj_invalbuf (bo=0xfffff8007e334658, flags=0, slpflag=0, slptimeo=0) at /usr/home/trasz/svn-ssh/android/sys/kern/vfs_subr.c:1661
#17 0xffffffff80b17dde in vinvalbuf (vp=<optimized out>, flags=0, slpflag=0, slptimeo=0) at /usr/home/trasz/svn-ssh/android/sys/kern/vfs_subr.c:1721
#18 vgonel (vp=0xfffff8007e334588) at /usr/home/trasz/svn-ssh/android/sys/kern/vfs_subr.c:3353
#19 0xffffffff80b1838f in vgone (vp=0xfffff8007e334588) at /usr/home/trasz/svn-ssh/android/sys/kern/vfs_subr.c:3229
#20 0xffffffff8091c654 in devfs_delete (dm=0xfffff8000d71ad80, de=0xfffff80004565100, flags=<optimized out>) at /usr/home/trasz/svn-ssh/android/sys/fs/devfs/devfs_devs.c:393

Diff Detail

Event Timeline

trasz added reviewers: kib, mckusick.

Can you explain how this patch fixes things (instead of papering over and allowing corruption or panic later) ?

From my understanding of the situation where your patch makes a difference, the buffer' dependencies are still not handled, and kernel will get its data corrupted when trying to write buffers which depend on the buffer you hacked on: the depended on buffer is destroyed and will not be found.

Also, why do you allow B_INVAL but not B_NOCACHE ?

The patch fixes an instapanic. Granted, the buffer won't get correctly handled later on - but that's a separate issue, and can't really be addressed until this one is fixed. That said, I don't quite follow: which buffer gets destroyed?

No idea about B_NOCACHE. Should I just add that, ie s/B_INVAL/B_INVAL | B_NOCACHE/?

The patch fixes an instapanic.

No, it does not. It incorrectly papers over ot.

Granted, the buffer won't get correctly handled later on - but that's a separate issue, and can't really be addressed until this one is fixed. That said, I don't quite follow: which buffer gets destroyed?

The buffer for which the call to softdep_deallocate_dependencies() is performed.

No idea about B_NOCACHE. Should I just add that, ie s/B_INVAL/B_INVAL | B_NOCACHE/?

Read the else if () condition in the brelse() code path which results in buf_deallocate() call.

Sigh.

Okay. Do you have any suggestions on what should happen in this case? How the buf should be handled?

Sigh.

Okay. Do you have any suggestions on what should happen in this case? How the buf should be handled?

We already discussed this in detail in D9674, see https://reviews.freebsd.org/D9674#201637 and below for the summary.