Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Nov 2018 21:58:22 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 233245] [UFS] Softupdates fails to track dependency between appended data and i_size
Message-ID:  <bug-233245-227@https.bugs.freebsd.org/bugzilla/>

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

            Bug ID: 233245
           Summary: [UFS] Softupdates fails to track dependency between
                    appended data and i_size
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: cem@freebsd.org

This manifests with recently appended files containing extraneous zero data=
 at
the end of the file after power loss or crash.

Detection of append could happen in either ffs_balloc_ufs[12] (which is whe=
re
most softdep dependencies seem to be added, and which is called uncondition=
ally
by ffs_write()) in the several "happy" cases where we discover we do not ne=
ed
to actually allocate a new block, e.g., cases like:

   753         if (lbn < UFS_NDADDR) {
...
   756                 nb =3D dp->di_db[lbn];
   757                 if (nb !=3D 0 && ip->i_size >=3D smalllblktosize(fs,=
 lbn +
1)) {
   758                         error =3D bread_gb(vp, lbn, fs->fs_bsize, NO=
CRED,
   759                             gbflags, &bp);
...
   764                         bp->b_blkno =3D fsbtodb(fs, nb);

+++                            if (DOINGSOFTDEP(vp) && startoffset + size >
ip->i_size)
+++                                    softdep_setup_append(...);

   765                         *bpp =3D bp;
   766                         return (0);

It could also just be checked in a single location in ffs_write() itself:

   754         for (error =3D 0; uio->uio_resid > 0;) {
   755                 lbn =3D lblkno(fs, uio->uio_offset);
   756                 blkoffset =3D blkoff(fs, uio->uio_offset);
...
   781                 if (uio->uio_offset + xfersize > ip->i_size) {

+++                            if (DOINGSOFTDEP(vp))
+++                                    softdep_setup_append(...);

   782                         ip->i_size =3D uio->uio_offset + xfersize;
   783                         DIP_SET(ip, i_size, ip->i_size);
   784                 }

Append data could probably be tracked in quite similar fashion to diradd
(directory entry adds).

--=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-233245-227>