From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Dave Chinner <david@fromorbit.com>
Cc: sandeen@redhat.com, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/6] libxfs: fix xfs_trans_alloc reservation abuse
Date: Mon, 1 Oct 2018 09:04:00 -0700 [thread overview]
Message-ID: <20181001160400.GC5872@magnolia> (raw)
In-Reply-To: <20180929223131.GI31060@dastard>
On Sun, Sep 30, 2018 at 08:31:31AM +1000, Dave Chinner wrote:
> On Thu, Sep 27, 2018 at 06:04:49PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Various xfsprogs tools have been abusing the transaction reservation
> > system by allocating the transaction with zero reservation. This has
> > always worked in the past because userspace transactions do not require
> > reservations. However, once we merge deferred ops into the transaction
> > structure, we will need to use a permanent reservation type to set up
> > any transaction that can roll. tr_itruncate has all we need, so use
> > that as the reservation dummy.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> > mkfs/proto.c | 19 +++++++++----------
> > mkfs/xfs_mkfs.c | 4 ++--
> > repair/phase5.c | 4 ++--
> > repair/phase6.c | 20 ++++++++------------
> > repair/rmap.c | 7 +++----
> > 5 files changed, 24 insertions(+), 30 deletions(-)
> >
> >
> > diff --git a/mkfs/proto.c b/mkfs/proto.c
> > index 07d019d6..9da0587e 100644
> > --- a/mkfs/proto.c
> > +++ b/mkfs/proto.c
> > @@ -123,9 +123,8 @@ getres(
> > uint r;
> >
> > for (i = 0, r = MKFS_BLOCKRES(blocks); r >= blocks; r--) {
> > - struct xfs_trans_res tres = {0};
> > -
> > - i = -libxfs_trans_alloc(mp, &tres, r, 0, 0, &tp);
> > + i = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate,
>
> I'm wondering if this should explicitly call out that it's a dummy
> reservation rather than using the itruncate reservation? e.g. these
> places use:
>
> i = -libxfs_trans_alloc_perm(mp, blks, rtblks, flags, &tp);
>
> And the implementation of this function then goes and uses the
> itruncate reservation with a comment explaining what thay is used
>
> (open to a better name - "dummy" doesn't seem right - perm, rolling,
> deferred, etc all seem appropriate to indicate that it's an
> allocation for a permanent transaction type for rolling/defered
> transactions).
I don't necessarily like the long name, but
"libxfs_trans_alloc_rollable" seems the most descriptive to me.
I do like using a helper instead of opencoding tr_itruncate
everywhere.
--D
>
> Cheers,
>
> Dave.
>
> --
> Dave Chinner
> david@fromorbit.com
next prev parent reply other threads:[~2018-10-01 22:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-28 1:04 [PATCH v2 0/6] xfsprogs-4.19: transaction cleanups Darrick J. Wong
2018-09-28 1:04 ` [PATCH 1/6] libxfs: port kernel transaction code Darrick J. Wong
2018-09-28 1:04 ` [PATCH 2/6] libxfs: fix libxfs_trans_alloc callsite problems Darrick J. Wong
2018-09-28 1:04 ` [PATCH 3/6] libxfs: fix xfs_trans_alloc reservation abuse Darrick J. Wong
2018-09-29 22:31 ` Dave Chinner
2018-10-01 16:04 ` Darrick J. Wong [this message]
2018-09-28 1:05 ` [PATCH 4/6] libxfs: check libxfs_trans_commit return values Darrick J. Wong
2018-09-28 1:05 ` [PATCH 5/6] libxfs: clean up IRELE/iput callsites Darrick J. Wong
2018-09-28 1:05 ` [PATCH 6/6] libxfs: track transaction block reservation usage like the kernel Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181001160400.GC5872@magnolia \
--to=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).