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 david@xxxxxxxxxxxxx _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs