Skip to contentSkip to conversation

xfsprogs: initialize filetype for lost+found creation

PATCH In review Eric Sandeen 4 participants 5 messages Sep 17, 2013 – Oct 18, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfsprogs: initialize filetype for lost+found creation

If we create lost+found make sure it's got the proper filetype.

---

(sorry, untested, not sure how to force creation when I can't use xfs_db to craft a filesystem that needs lost+found)

repair/phase6.c +2 -0
index a4ad7a3..946cb6d 100644
@@ -904,6 +904,8 @@ mk_orphanage(xfs_mount_t *mp)
 
 	xname.name = (unsigned char *)ORPHANAGE;
 	xname.len = strlen(ORPHANAGE);
+	xname.type = XFS_DIR3_FT_DIR;
+
 	if (libxfs_dir_lookup(NULL, pip, &xname, &ino, NULL) == 0)
 		return ino;
 

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Eric Sandeen

If we create lost+found make sure it's got the proper filetype.

---

(sorry, untested, not sure how to force creation when I can't use xfs_db to craft a filesystem that needs lost+found)

The {lib}xfs_dir_lookup() doesn't use the field - just like extended attributes use xfs_names but it won't use the field entry, but it does not hurt to have it initialized to something.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
Quoted 10 lines · Mark Tinguely
Quoted 7 lines · Eric Sandeen

If we create lost+found make sure it's got the proper filetype.

---

(sorry, untested, not sure how to force creation when I can't use xfs_db to craft a filesystem that needs lost+found)

The {lib}xfs_dir_lookup() doesn't use the field - just like extended attributes use xfs_names but it won't use the field entry, but it does not hurt to have it initialized to something.

Thanks for the review - just FWIW, I was thinking that it needs to be initialized so that when created, it is created with the proper type, rather than random stack noise.

It seems, though, that we're still missing bits in libxfs to actually write the types to disk; I'll look into that.

Thanks,
-Eric

Quoted 7 lines

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw
Quoted 10 lines · Eric Sandeen
Quoted 9 lines · Mark Tinguely
Quoted 7 lines · Eric Sandeen

If we create lost+found make sure it's got the proper filetype.

---

(sorry, untested, not sure how to force creation when I can't use xfs_db to craft a filesystem that needs lost+found)

Quoted 8 lines
Quoted 1 line

The {lib}xfs_dir_lookup() doesn't use the field - just like extended attributes use xfs_names but it won't use the field entry, but it does not hurt to have it initialized to something.

Thanks for the review - just FWIW, I was thinking that it needs to be initialized so that when created, it is created with the proper type, rather than random stack noise.

It seems, though, that we're still missing bits in libxfs to actually write the types to disk; I'll look into that.

Patch below.

Cheers,

Dave.

Signature · 14 lines
Dave Chinner
[email protected]


libxfs: fix missing filetype updates to xfs_dir2.c

From: Dave Chinner <[email protected]>

They were missed in the original patch that was committed.

Signed-off-by: Dave Chinner <[email protected]>
---
 libxfs/xfs_dir2.c | 3 +++
 1 file changed, 3 insertions(+)
libxfs/xfs_dir2.c +3 -0
index 010c701..96a3c1d 100644
@@ -194,6 +194,7 @@ xfs_dir_createname(
 	memset(&args, 0, sizeof(xfs_da_args_t));
 	args.name = name->name;
 	args.namelen = name->len;
+	args.filetype = name->type;
 	args.hashval = dp->i_mount->m_dirnameops->hashname(name);
 	args.inumber = inum;
 	args.dp = dp;
@@ -268,6 +269,7 @@ xfs_dir_lookup(
 	memset(&args, 0, sizeof(xfs_da_args_t));
 	args.name = name->name;
 	args.namelen = name->len;
+	args.filetype = name->type;
 	args.hashval = dp->i_mount->m_dirnameops->hashname(name);
 	args.dp = dp;
 	args.whichfork = XFS_DATA_FORK;
@@ -323,6 +325,7 @@ xfs_dir_removename(
 	memset(&args, 0, sizeof(xfs_da_args_t));
 	args.name = name->name;
 	args.namelen = name->len;
+	args.filetype = name->type;
 	args.hashval = dp->i_mount->m_dirnameops->hashname(name);
 	args.inumber = ino;
 	args.dp = dp;

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs