All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Dave Chinner <david@fromorbit.com>, xfs@oss.sgi.com
Subject: Re: [PATCH 2/2] mkfs: proto file creation does not set ftype correctly
Date: Thu, 27 Feb 2014 08:17:43 -0600	[thread overview]
Message-ID: <530F4907.5010808@sandeen.net> (raw)
In-Reply-To: <1393494344-30056-3-git-send-email-david@fromorbit.com>

On 2/27/14, 3:45 AM, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> 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@redhat.com>

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@redhat.com>

> ---
>  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@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2014-02-27 14:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-27  9:45 [PATCH 0/2] xfsprogs: mkfs fixes Dave Chinner
2014-02-27  9:45 ` [PATCH 1/2] mkfs: default log size for small filesystems too large Dave Chinner
2014-02-27 22:29   ` Eric Sandeen
2014-02-28  1:03     ` Dave Chinner
2014-02-28  3:12   ` Eric Sandeen
2014-02-28 13:09   ` Brian Foster
2014-02-27  9:45 ` [PATCH 2/2] mkfs: proto file creation does not set ftype correctly Dave Chinner
2014-02-27 14:17   ` Eric Sandeen [this message]
2014-02-27 19:40     ` Dave Chinner

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=530F4907.5010808@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=david@fromorbit.com \
    --cc=xfs@oss.sgi.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.