* [PATCH] xfs_repair: warn properly about reflink flag with and without -n
@ 2018-09-12 19:26 Eric Sandeen
2018-09-12 22:05 ` Eric Sandeen
0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2018-09-12 19:26 UTC (permalink / raw)
To: linux-xfs
The decision to emit a warning in fix_inode_reflink_flag seems broken; in
no-modify mode we'll do_warn that we're setting it (even though we don't),
and we'll be silent if it needs to be cleared.
Fix this so it's the standard "would" in no-modify, and "will" in regular
mode. This also ensures that we return the proper status if flags are
found to be incorrect in -n or -e mode.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/repair/rmap.c b/repair/rmap.c
index bffb5b61..7ef2d0fd 100644
--- a/repair/rmap.c
+++ b/repair/rmap.c
@@ -1142,16 +1142,27 @@ fix_inode_reflink_flag(
struct xfs_dinode *dino;
struct xfs_buf *buf;
+ if (no_modify) {
+ if (set)
+ do_warn(
+_("would set reflink flag on inode %"PRIu64"\n"),
+ XFS_AGINO_TO_INO(mp, agno, agino));
+ else
+ do_warn(
+_("would clear reflink flag on inode %"PRIu64"\n"),
+ XFS_AGINO_TO_INO(mp, agno, agino));
+ return 0;
+ }
+
+ /* Modify mode */
if (set)
do_warn(
_("setting reflink flag on inode %"PRIu64"\n"),
XFS_AGINO_TO_INO(mp, agno, agino));
- else if (!no_modify) /* && !set */
+ else
do_warn(
_("clearing reflink flag on inode %"PRIu64"\n"),
XFS_AGINO_TO_INO(mp, agno, agino));
- if (no_modify)
- return 0;
buf = get_agino_buf(mp, agno, agino, &dino);
if (!buf)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs_repair: warn properly about reflink flag with and without -n
2018-09-12 19:26 [PATCH] xfs_repair: warn properly about reflink flag with and without -n Eric Sandeen
@ 2018-09-12 22:05 ` Eric Sandeen
2018-09-17 16:24 ` Darrick J. Wong
0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2018-09-12 22:05 UTC (permalink / raw)
To: Eric Sandeen, linux-xfs
On 9/12/18 2:26 PM, Eric Sandeen wrote:
> The decision to emit a warning in fix_inode_reflink_flag seems broken; in
> no-modify mode we'll do_warn that we're setting it (even though we don't),
> and we'll be silent if it needs to be cleared.
>
> Fix this so it's the standard "would" in no-modify, and "will" in regular
> mode. This also ensures that we return the proper status if flags are
> found to be incorrect in -n or -e mode.
Oh, oops - I guess this might have been intentional, if "clear reflink flag
on non-reflinked file" is more of a preening operation? So in -n mode
nothing happens, but we preen/clear it in full mode?
(but in that case do_warn in the full run still triggers a non-zero
exit code with -e ... bleah)
(also: this makes refusing to map & boot from "reflinked" files that may
not even /be/ reflinked at all even /more/ awesomely random, doesn't it!)
-Eric
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> diff --git a/repair/rmap.c b/repair/rmap.c
> index bffb5b61..7ef2d0fd 100644
> --- a/repair/rmap.c
> +++ b/repair/rmap.c
> @@ -1142,16 +1142,27 @@ fix_inode_reflink_flag(
> struct xfs_dinode *dino;
> struct xfs_buf *buf;
>
> + if (no_modify) {
> + if (set)
> + do_warn(
> +_("would set reflink flag on inode %"PRIu64"\n"),
> + XFS_AGINO_TO_INO(mp, agno, agino));
> + else
> + do_warn(
> +_("would clear reflink flag on inode %"PRIu64"\n"),
> + XFS_AGINO_TO_INO(mp, agno, agino));
> + return 0;
> + }
> +
> + /* Modify mode */
> if (set)
> do_warn(
> _("setting reflink flag on inode %"PRIu64"\n"),
> XFS_AGINO_TO_INO(mp, agno, agino));
> - else if (!no_modify) /* && !set */
> + else
> do_warn(
> _("clearing reflink flag on inode %"PRIu64"\n"),
> XFS_AGINO_TO_INO(mp, agno, agino));
> - if (no_modify)
> - return 0;
>
> buf = get_agino_buf(mp, agno, agino, &dino);
> if (!buf)
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs_repair: warn properly about reflink flag with and without -n
2018-09-12 22:05 ` Eric Sandeen
@ 2018-09-17 16:24 ` Darrick J. Wong
0 siblings, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2018-09-17 16:24 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Eric Sandeen, linux-xfs
On Wed, Sep 12, 2018 at 05:05:40PM -0500, Eric Sandeen wrote:
> On 9/12/18 2:26 PM, Eric Sandeen wrote:
> > The decision to emit a warning in fix_inode_reflink_flag seems broken; in
> > no-modify mode we'll do_warn that we're setting it (even though we don't),
> > and we'll be silent if it needs to be cleared.
> >
> > Fix this so it's the standard "would" in no-modify, and "will" in regular
> > mode. This also ensures that we return the proper status if flags are
> > found to be incorrect in -n or -e mode.
>
> Oh, oops - I guess this might have been intentional, if "clear reflink flag
> on non-reflinked file" is more of a preening operation?
Correct.
> So in -n mode nothing happens, but we preen/clear it in full mode?
Correct.
> (but in that case do_warn in the full run still triggers a non-zero
> exit code with -e ... bleah)
I think you're correct that it's not necessary to trigger a nonzero exit
code for a successful preening operation.
> (also: this makes refusing to map & boot from "reflinked" files that may
The purpose of the reflink iflag is a hint to the fs that it needs to
check the refcount data when performing writes. IOWs, we use it to
avoid a performance hit when writing to files that have never been
shared (at least not since creation/the last xfs_{repair,scrub} run/the
last zero-to-eof FUNSHARE call) on a filesystem that supports reflink.
> not even /be/ reflinked at all even /more/ awesomely random, doesn't it!)
"not even be reflinked at all any more..." :)
--D
> -Eric
>
> > Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> > ---
> >
> > diff --git a/repair/rmap.c b/repair/rmap.c
> > index bffb5b61..7ef2d0fd 100644
> > --- a/repair/rmap.c
> > +++ b/repair/rmap.c
> > @@ -1142,16 +1142,27 @@ fix_inode_reflink_flag(
> > struct xfs_dinode *dino;
> > struct xfs_buf *buf;
> >
> > + if (no_modify) {
> > + if (set)
> > + do_warn(
> > +_("would set reflink flag on inode %"PRIu64"\n"),
> > + XFS_AGINO_TO_INO(mp, agno, agino));
> > + else
> > + do_warn(
> > +_("would clear reflink flag on inode %"PRIu64"\n"),
> > + XFS_AGINO_TO_INO(mp, agno, agino));
> > + return 0;
> > + }
> > +
> > + /* Modify mode */
> > if (set)
> > do_warn(
> > _("setting reflink flag on inode %"PRIu64"\n"),
> > XFS_AGINO_TO_INO(mp, agno, agino));
> > - else if (!no_modify) /* && !set */
> > + else
> > do_warn(
> > _("clearing reflink flag on inode %"PRIu64"\n"),
> > XFS_AGINO_TO_INO(mp, agno, agino));
> > - if (no_modify)
> > - return 0;
> >
> > buf = get_agino_buf(mp, agno, agino, &dino);
> > if (!buf)
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-17 21:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-12 19:26 [PATCH] xfs_repair: warn properly about reflink flag with and without -n Eric Sandeen
2018-09-12 22:05 ` Eric Sandeen
2018-09-17 16:24 ` Darrick J. Wong
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).