Re: [PATCH 2/2] mkfs: proto file creation does not set ftype correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/27/14, 3:45 AM, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> Hence running xfs_repair on a ftype enable filesystem that has
> contents created by a proto file will throw warnings on mismatched
> ftype entries and correct them. xfs/031 fails due to this problem.
> 
> Fix it by settin gup the xname structure with the correct type

"setting up"

> fields.
> 
> Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>

huh, surprised that hung out there for so long ;)

I guess the root inode is handled by core mkfs code, right?
(around line 544)

And I notice that "r" filetypes aren't documented in the
manpage but that's a different issue.

As long as I'm right about the root inode,

Reviewed-by: Eric Sandeen <sandeen@xxxxxxxxxx>

> ---
>  mkfs/proto.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/mkfs/proto.c b/mkfs/proto.c
> index 4cc0df6..4d3680d 100644
> --- a/mkfs/proto.c
> +++ b/mkfs/proto.c
> @@ -438,6 +438,7 @@ parseproto(
>  	creds.cr_gid = (int)getnum(pp);
>  	xname.name = (uchar_t *)name;
>  	xname.len = name ? strlen(name) : 0;
> +	xname.type = 0;
>  	tp = libxfs_trans_alloc(mp, 0);
>  	flags = XFS_ILOG_CORE;
>  	xfs_bmap_init(&flist, &first);
> @@ -453,6 +454,7 @@ parseproto(
>  		if (buf)
>  			free(buf);
>  		libxfs_trans_ijoin(tp, pip, 0);
> +		xname.type = XFS_DIR3_FT_REG_FILE;
>  		newdirent(mp, tp, pip, &xname, ip->i_ino, &first, &flist);
>  		libxfs_trans_ihold(tp, pip);
>  		break;
> @@ -469,6 +471,7 @@ parseproto(
>  
>  		libxfs_trans_ijoin(tp, pip, 0);
>  
> +		xname.type = XFS_DIR3_FT_REG_FILE;
>  		newdirent(mp, tp, pip, &xname, ip->i_ino, &first, &flist);
>  		libxfs_trans_ihold(tp, pip);
>  		libxfs_trans_log_inode(tp, ip, flags);
> @@ -490,6 +493,7 @@ parseproto(
>  			fail(_("Inode allocation failed"), error);
>  		}
>  		libxfs_trans_ijoin(tp, pip, 0);
> +		xname.type = XFS_DIR3_FT_BLKDEV;
>  		newdirent(mp, tp, pip, &xname, ip->i_ino, &first, &flist);
>  		libxfs_trans_ihold(tp, pip);
>  		flags |= XFS_ILOG_DEV;
> @@ -504,6 +508,7 @@ parseproto(
>  		if (error)
>  			fail(_("Inode allocation failed"), error);
>  		libxfs_trans_ijoin(tp, pip, 0);
> +		xname.type = XFS_DIR3_FT_CHRDEV;
>  		newdirent(mp, tp, pip, &xname, ip->i_ino, &first, &flist);
>  		libxfs_trans_ihold(tp, pip);
>  		flags |= XFS_ILOG_DEV;
> @@ -516,6 +521,7 @@ parseproto(
>  		if (error)
>  			fail(_("Inode allocation failed"), error);
>  		libxfs_trans_ijoin(tp, pip, 0);
> +		xname.type = XFS_DIR3_FT_FIFO;
>  		newdirent(mp, tp, pip, &xname, ip->i_ino, &first, &flist);
>  		libxfs_trans_ihold(tp, pip);
>  		break;
> @@ -529,6 +535,7 @@ parseproto(
>  			fail(_("Inode allocation failed"), error);
>  		flags |= newfile(tp, ip, &flist, &first, 1, 1, buf, len);
>  		libxfs_trans_ijoin(tp, pip, 0);
> +		xname.type = XFS_DIR3_FT_SYMLINK;
>  		newdirent(mp, tp, pip, &xname, ip->i_ino, &first, &flist);
>  		libxfs_trans_ihold(tp, pip);
>  		break;
> @@ -546,6 +553,7 @@ parseproto(
>  			isroot = 1;
>  		} else {
>  			libxfs_trans_ijoin(tp, pip, 0);
> +			xname.type = XFS_DIR3_FT_DIR;
>  			newdirent(mp, tp, pip, &xname, ip->i_ino,
>  				  &first, &flist);
>  			pip->i_d.di_nlink++;
> 

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux