[Top] [All Lists]

Re: [PATCH] xfsprogs: handle symlinks etc in fs_table_initialise_mounts(

To: Eric Sandeen <sandeen@xxxxxxxxxx>
Subject: Re: [PATCH] xfsprogs: handle symlinks etc in fs_table_initialise_mounts()
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Tue, 15 Oct 2013 07:46:17 +1100
Cc: xfs-oss <xfs@xxxxxxxxxxx>, Satoru Takeuchi <takeuchi_satoru@xxxxxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <5249AE5F.30305@xxxxxxxxxx>
References: <5249AE5F.30305@xxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Mon, Sep 30, 2013 at 12:01:19PM -0500, Eric Sandeen wrote:
> Commit:
> 6a23747d xfs_quota: support relative path as `path' arguments
> used realpath() on the supplied pathname to handle things like
> relative pathnames and pathnames ending in "/" which otherwise
> caused the getmntent scanning to fail.
> However, this regressed cases where a path in mtab was a symlink;
> realpath() resolves this to the target, and so no match is found.
> This causes i.e.:
> # xfs_quota -x -c report /dev/mapper/testvg-testlv
> to fail with:
> xfs_quota: cannot setup path for mount /dev/mapper/testvg-testlv: No such 
> device or address
> because the scanning looks for /dev/dm-3, but the long symlink
> name is what exists in mtab, and no match is found.
> Fix this, but keep the intended enhancements, by testing *both* the
> user-specified path (which might be relative, or contain a trailing
> slash on a mountpoint) and the realpath-resolved path (which turns
> a relative mountpoint into a full path, and removes trailing slashes),
> to determine whether the user-specified path is an xfs mountpoint or
> device.
> While we're at it, add a few comments, and go back to the testing
> of "path" not "rpath"; whether or not path is passed to the function
> is what determines control flow.  If path is specified, and realpath
> succeeds, we're guaranteed to have rpath as well, so there is no need
> to retest that.  rpath is initialized to NULL, so an unconditional
> free(rpath) is safe as well.
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
> ---

Looks good. There's a bunch of minor cleanups that could be done to
this code, but save that for a rainy day...

Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>

Dave Chinner

<Prev in Thread] Current Thread [Next in Thread>