All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@redhat.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: linux-xfs@vger.kernel.org,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	Eric Sandeen <sandeen@redhat.com>
Subject: Re: [PATCH v2 2/2] xfsdump: intercept bind mount targets
Date: Tue, 3 Nov 2020 23:18:06 +0800	[thread overview]
Message-ID: <20201103151806.GA886627@xiangao.remote.csb> (raw)
In-Reply-To: <5ac048c3-7db6-4487-78ae-86ee9851c5c8@sandeen.net>


Hi Eric,

On Tue, Nov 03, 2020 at 09:03:48AM -0600, Eric Sandeen wrote:
> On 11/2/20 8:33 PM, Gao Xiang wrote:

...

> > +
> > +		nread = getdents_wrap(fd, (char *)gdp, gdsz);
> > +		/*
> > +		 * negative count indicates something very bad happened;
> > +		 * try to gracefully end this dir.
> > +		 */
> > +		if (nread < 0) {
> > +			mlog(MLOG_NORMAL | MLOG_WARNING,
> > +_("unable to read dirents for directory ino %llu: %s\n"),
> > +			      ino, strerror(errno));
> > +			/* !!! curtis looked at this, and pointed out that
> 
> Nobody knows who curtis is, I think we can drop this comment now ;)
> If we can't read the directory I think it's fine to simply error out here.

This was copied from dump_dir(), ok, I will error out this.

> 
> > +			 * we could take some recovery action here. if the
> > +			 * errno is appropriate, lseek64 to the value of
> > +			 * doff field of the last dirent successfully
> > +			 * obtained, and contiue the loop.
> > +			 */
> > +			nread = 0; /* pretend we are done */
> > +		}
> > +
> > +		/* no more directory entries: break; */
> > +		if (!nread)
> > +			break;
> > +
> > +		for (p = gdp; nread > 0;
> > +		     nread -= (int)p->d_reclen,
> > +		     assert(nread >= 0),
> > +		     p = (struct dirent *)((char *)p + p->d_reclen)) {
> > +			if (!strcmp(p->d_name, "..") && p->d_ino == ino) {
> > +				mlog(MLOG_DEBUG, "FOUND: name %s d_ino %llu\n",
> > +				     p->d_name, ino);
> > +				free(gdp);
> > +				return BOOL_TRUE;
> > +			}
> 
> I think we can stop as soon as we have found ".." yes?  No need to continue
> iterating the directory, either ".." is what we wanted, or it's not, but either
> way we are done when we have checked it.  On the off chance that we have
> a very large root dir, stopping early might be good.

Yes, that is correct.

> 
> > +		}
> > +	}
> > +	free(gdp);
> > +	return BOOL_FALSE;
> > +}
> > +
> >  bool_t
> >  content_init(int argc,
> >  	      char *argv[],
> > @@ -1393,6 +1448,13 @@ baseuuidbypass:
> >  			      mntpnt);
> >  			return BOOL_FALSE;
> >  		}
> > +
> > +		if (!check_rootdir(sc_fsfd, rootstat.st_ino)) {
> > +			mlog(MLOG_ERROR,
> > +"oops, seems to be a bind mount, please use the actual mountpoint instead\n");
> 
> Could there be any other reason for this failure?  Maybe something like:
> 
> 			mlog(MLOG_ERROR,
> _("%s is not the root of the filesystem (bind mount?) - use primary mountpoint\n"),
> 				mntpnt);
> 
> or similar?
> 
> in any case I think it needs the i18n _("...") treatment.

Ok, will quickly send the fixed version about this!


Thanks for your review!


Thanks,
Gao Xiang

> 
> Thanks!
> 
> -Eric
> 
> > +			return BOOL_FALSE;
> > +		}
> > +
> >  		sc_rootxfsstatp =
> >  			(struct xfs_bstat *)calloc(1, sizeof(struct xfs_bstat));
> >  		assert(sc_rootxfsstatp);
> > 
> 


  reply	other threads:[~2020-11-03 15:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03  2:33 [PATCH v2 1/2] xfsdump: Revert "xfsdump: handle bind mount targets" Gao Xiang
2020-11-03  2:33 ` [PATCH v2 2/2] xfsdump: intercept bind mount targets Gao Xiang
2020-11-03 15:03   ` Eric Sandeen
2020-11-03 15:18     ` Gao Xiang [this message]
2020-11-03 15:33   ` [PATCH v3 " Gao Xiang
2021-06-03 20:53     ` Eric Sandeen
2021-09-27 15:07     ` Bill O'Donnell
2021-12-20 16:01     ` Masayoshi Mizuma
2021-12-20 19:58       ` Eric Sandeen
2021-06-03 20:29 ` [PATCH v2 1/2] xfsdump: Revert "xfsdump: handle bind mount targets" Eric Sandeen
2021-09-27 15:05 ` Bill O'Donnell

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=20201103151806.GA886627@xiangao.remote.csb \
    --to=hsiangkao@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --cc=sandeen@sandeen.net \
    --subject='Re: [PATCH v2 2/2] xfsdump: intercept bind mount targets' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.