Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 May 2018 12:38:37 +0000
From:      bugzilla-noreply@freebsd.org
To:        fs@FreeBSD.org
Subject:   [Bug 210316] panic after trying to r/w mount msdosfs on write protected media
Message-ID:  <bug-210316-3630-m2xgH82cja@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-210316-3630@https.bugs.freebsd.org/bugzilla/>
References:  <bug-210316-3630@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D210316

--- Comment #10 from Andriy Gapon <avg@FreeBSD.org> ---
(In reply to Konstantin Belousov from comment #9)

Kostik,
I need to refresh my memory of this problem.

Meanwhile, I have a counter-question.
Is there a bwrite variant where a failure is a final failure with no side
effects?  I mean, if that bwriteX fails, then the buffer is just discarded.
Something with semantics similar to write(2).

My understanding of what happens now.
bufwrite calls this code:
        if ((oldflags & B_ASYNC) =3D=3D 0) {
                int rtval =3D bufwait(bp);
                brelse(bp);
                return (rtval);

Then in brelse() the following block is executed:
        if (bp->b_iocmd =3D=3D BIO_WRITE && (bp->b_ioflags & BIO_ERROR) &&
            (bp->b_error !=3D ENXIO || !LIST_EMPTY(&bp->b_dep)) &&
            !(bp->b_flags & B_INVAL)) {
                /*
                 * Failed write, redirty.  All errors except ENXIO (which
                 * means the device is gone) are expected to be potentially
                 * transient - underlying media might work if tried again
                 * after EIO, and memory might be available after an ENOMEM.
                 *
                 * Do this also for buffers that failed with ENXIO, but have
                 * non-empty dependencies - the soft updates code might need
                 * to access the buffer to untangle them.
                 *
                 * Must clear BIO_ERROR to prevent pages from being scrappe=
d.
                 */
                bp->b_ioflags &=3D ~BIO_ERROR;
                bdirty(bp);

I think that it would be nice to have a way to instruct the buffer code to
never retry a specific synchronous write request.
If we had such a mechanism we could use it in filesystems's mount code to c=
heck
whether we can really write to the backing media.

Or should a caller of bwrite() explicitly manipulate b_flags (e.g. B_INVAL,
B_RELBUF) to get the desired effect?

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-210316-3630-m2xgH82cja>