Skip to contentSkip to conversation

xfs_io/lsattr: expose FS_XFLAG_HASATTR flag

PATCH In review Amir Goldstein 3 participants 9 messages Nov 6, 2019 – Nov 8, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs_io/lsattr: expose FS_XFLAG_HASATTR flag

For efficient check if file has xattrs.

---
 io/attr.c | 2 ++
 1 file changed, 2 insertions(+)
io/attr.c +2 -0
index b713d017..ba88ef16 100644
@@ -37,6 +37,7 @@ static struct xflags {
 	{ FS_XFLAG_FILESTREAM,		"S", "filestream"	},
 	{ FS_XFLAG_DAX,			"x", "dax"		},
 	{ FS_XFLAG_COWEXTSIZE,		"C", "cowextsize"	},
+	{ FS_XFLAG_HASATTR,		"X", "has-xattr"	},
 	{ 0, NULL, NULL }
 };
 #define CHATTR_XFLAG_LIST	"r"/*p*/"iasAdtPneEfSxC"
@@ -65,6 +66,7 @@ lsattr_help(void)
 " S -- enable filestreams allocator for this directory\n"
 " x -- Use direct access (DAX) for data in this file\n"
 " C -- for files with shared blocks, observe the inode CoW extent size value\n"
+" X -- file has extended attributes (cannot be changed using chattr)\n"
 "\n"
 " Options:\n"
 " -R -- recursively descend (useful when current file is a directory)\n"
Signature · 1 line
2.17.1
#1 lore raw
Quoted 12 lines · Amir Goldstein

For efficient check if file has xattrs.

---
 io/attr.c | 2 ++
 1 file changed, 2 insertions(+)
io/attr.c +0 -0
index b713d017..ba88ef16 100644

io/attr.c static struct xflags { · line 43

Quoted 7 lines
io/attr.c +1 -0
@@ -37,6 +37,7 @@ static struct xflags {
 	{ FS_XFLAG_FILESTREAM,		"S", "filestream"	},
 	{ FS_XFLAG_DAX,			"x", "dax"		},
 	{ FS_XFLAG_COWEXTSIZE,		"C", "cowextsize"	},
+	{ FS_XFLAG_HASATTR,		"X", "has-xattr"	},
 	{ 0, NULL, NULL }
 };
 #define CHATTR_XFLAG_LIST	"r"/*p*/"iasAdtPneEfSxC"

/me wonders if this should have /*X*/ commented out the same way we do for "p".

Otherwise, the patch looks ok to me...

/me *also* wonders how many filesystems fail to implement this flag but support xattrs.

Oh. All of them. Though I assume overlayfs is being patched... :)

--D

Quoted 11 lines
io/attr.c +1 -0
@@ -65,6 +66,7 @@ lsattr_help(void)
 " S -- enable filestreams allocator for this directory\n"
 " x -- Use direct access (DAX) for data in this file\n"
 " C -- for files with shared blocks, observe the inode CoW extent size value\n"
+" X -- file has extended attributes (cannot be changed using chattr)\n"
 "\n"
 " Options:\n"
 " -R -- recursively descend (useful when current file is a directory)\n"
Signature · 1 line
2.17.1
#2 lore raw
Quoted 9 lines · Darrick J. Wong
Quoted 7 lines · Amir Goldstein

For efficient check if file has xattrs.

---
 io/attr.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 15 lines

io/attr.c static struct xflags { · line 43

Quoted 12 lines
io/attr.c +1 -0
index b713d017..ba88ef16 100644
@@ -37,6 +37,7 @@ static struct xflags {
      { FS_XFLAG_FILESTREAM,          "S", "filestream"       },
      { FS_XFLAG_DAX,                 "x", "dax"              },
      { FS_XFLAG_COWEXTSIZE,          "C", "cowextsize"       },
+     { FS_XFLAG_HASATTR,             "X", "has-xattr"        },
      { 0, NULL, NULL }
 };
 #define CHATTR_XFLAG_LIST    "r"/*p*/"iasAdtPneEfSxC"

/me wonders if this should have /*X*/ commented out the same way we do for "p".

Sure. Eric, please let me know if you want a re-submit for this.

Quoted 8 lines

Otherwise, the patch looks ok to me...

/me *also* wonders how many filesystems fail to implement this flag but support xattrs.

Oh. All of them. Though I assume overlayfs is being patched... :)

It doesn't need to be patched. It doesn't have xattr storage of its own. The ioctl is passed down to the underlying fs (*).
(*) The ioctl is currently blocked on overlayfs directories.

Thanks,
Amir.

#3 lore raw
Quoted 26 lines · Amir Goldstein
Quoted 9 lines · Darrick J. Wong
Quoted 7 lines · Amir Goldstein

For efficient check if file has xattrs.

---
 io/attr.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 15 lines

io/attr.c static struct xflags { · line 43

Quoted 12 lines
io/attr.c +1 -0
index b713d017..ba88ef16 100644
@@ -37,6 +37,7 @@ static struct xflags {
      { FS_XFLAG_FILESTREAM,          "S", "filestream"       },
      { FS_XFLAG_DAX,                 "x", "dax"              },
      { FS_XFLAG_COWEXTSIZE,          "C", "cowextsize"       },
+     { FS_XFLAG_HASATTR,             "X", "has-xattr"        },
      { 0, NULL, NULL }
 };
 #define CHATTR_XFLAG_LIST    "r"/*p*/"iasAdtPneEfSxC"

/me wonders if this should have /*X*/ commented out the same way we do for "p".

Quoted 1 line

Sure. Eric, please let me know if you want a re-submit for this.

Ummm I'll just stage it now and add it so I don't forget

like:

#define CHATTR_XFLAG_LIST "r"/*p*/"iasAdtPneEfS"/*X*/"xC"

that, right?

Quoted 16 lines
Quoted 8 lines

Otherwise, the patch looks ok to me...

/me *also* wonders how many filesystems fail to implement this flag but support xattrs.

Oh. All of them. Though I assume overlayfs is being patched... :)

It doesn't need to be patched. It doesn't have xattr storage of its own. The ioctl is passed down to the underlying fs (*).
(*) The ioctl is currently blocked on overlayfs directories.

Thanks,
Amir.

#4 lore raw
Quoted 29 lines · Eric Sandeen
Quoted 26 lines · Amir Goldstein
Quoted 9 lines · Darrick J. Wong
Quoted 7 lines · Amir Goldstein

For efficient check if file has xattrs.

---
 io/attr.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 15 lines

io/attr.c static struct xflags { · line 43

Quoted 12 lines
io/attr.c +1 -0
index b713d017..ba88ef16 100644
@@ -37,6 +37,7 @@ static struct xflags {
      { FS_XFLAG_FILESTREAM,          "S", "filestream"       },
      { FS_XFLAG_DAX,                 "x", "dax"              },
      { FS_XFLAG_COWEXTSIZE,          "C", "cowextsize"       },
+     { FS_XFLAG_HASATTR,             "X", "has-xattr"        },
      { 0, NULL, NULL }
 };
 #define CHATTR_XFLAG_LIST    "r"/*p*/"iasAdtPneEfSxC"

/me wonders if this should have /*X*/ commented out the same way we do for "p".

Quoted 1 line

Sure. Eric, please let me know if you want a re-submit for this.

Quoted 7 lines

Ummm I'll just stage it now and add it so I don't forget

like:

#define CHATTR_XFLAG_LIST "r"/*p*/"iasAdtPneEfS"/*X*/"xC"

that, right?

Right.

--D

Quoted 16 lines
Quoted 16 lines
Quoted 8 lines

Otherwise, the patch looks ok to me...

/me *also* wonders how many filesystems fail to implement this flag but support xattrs.

Oh. All of them. Though I assume overlayfs is being patched... :)

It doesn't need to be patched. It doesn't have xattr storage of its own. The ioctl is passed down to the underlying fs (*).
(*) The ioctl is currently blocked on overlayfs directories.

Thanks,
Amir.

#5 lore raw
Quoted 12 lines · Darrick J. Wong
Quoted 11 lines · Eric Sandeen
Quoted 6 lines · Amir Goldstein
Quoted 4 lines
Quoted 1 line

#define CHATTR_XFLAG_LIST "r"/*p*/"iasAdtPneEfSxC"

/me wonders if this should have /*X*/ commented out the same way we do for "p".

Sure. Eric, please let me know if you want a re-submit for this.

Ummm I'll just stage it now and add it so I don't forget

Quoted 7 lines
Quoted 5 lines

like:

#define CHATTR_XFLAG_LIST "r"/*p*/"iasAdtPneEfS"/*X*/"xC"

that, right?

Right.

Actually for consistent ordering w/ the array, I guess maybe

#define CHATTR_XFLAG_LIST "r"/*p*/"iasAdtPneEfSxC"/*X*/

Thanks

-Eric

Reviewed-by
#6 lore raw
Quoted 19 lines · Eric Sandeen
Quoted 16 lines · Darrick J. Wong
Quoted 15 lines · Eric Sandeen
Quoted 6 lines · Amir Goldstein
Quoted 4 lines
Quoted 1 line

#define CHATTR_XFLAG_LIST "r"/*p*/"iasAdtPneEfSxC"

/me wonders if this should have /*X*/ commented out the same way we do for "p".

Sure. Eric, please let me know if you want a re-submit for this.

Ummm I'll just stage it now and add it so I don't forget

like:

#define CHATTR_XFLAG_LIST "r"/*p*/"iasAdtPneEfS"/*X*/"xC"

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

that, right?

Right.

Actually for consistent ordering w/ the array, I guess maybe

#define CHATTR_XFLAG_LIST "r"/*p*/"iasAdtPneEfSxC"/*X*/

Sure. /me is done beating this hoss.

--D

Quoted 3 lines

Thanks

-Eric

#7 lore raw
In reply to Amir Goldstein
Quoted 12 lines · Amir Goldstein

For efficient check if file has xattrs.

---
 io/attr.c | 2 ++
 1 file changed, 2 insertions(+)
io/attr.c +0 -0
index b713d017..ba88ef16 100644

io/attr.c static struct xflags { · line 40

Quoted 4 lines
io/attr.c +1 -0
@@ -37,6 +37,7 @@ static struct xflags {
 	{ FS_XFLAG_FILESTREAM,		"S", "filestream"	},
 	{ FS_XFLAG_DAX,			"x", "dax"		},
 	{ FS_XFLAG_COWEXTSIZE,		"C", "cowextsize"	},
+	{ FS_XFLAG_HASATTR,		"X", "has-xattr"	},

This causes an xfs/207 regression on the extra letter in the output; can you please fix that?

--D

Quoted 14 lines
io/attr.c +1 -0
 	{ 0, NULL, NULL }
 };
 #define CHATTR_XFLAG_LIST	"r"/*p*/"iasAdtPneEfSxC"
@@ -65,6 +66,7 @@ lsattr_help(void)
 " S -- enable filestreams allocator for this directory\n"
 " x -- Use direct access (DAX) for data in this file\n"
 " C -- for files with shared blocks, observe the inode CoW extent size value\n"
+" X -- file has extended attributes (cannot be changed using chattr)\n"
 "\n"
 " Options:\n"
 " -R -- recursively descend (useful when current file is a directory)\n"
Signature · 1 line
2.17.1
#8 lore raw
Quoted 8 lines · Darrick J. Wong
Quoted 7 lines · Amir Goldstein

For efficient check if file has xattrs.

---
 io/attr.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 12 lines

io/attr.c static struct xflags { · line 40

Quoted 9 lines
io/attr.c +1 -0
index b713d017..ba88ef16 100644
@@ -37,6 +37,7 @@ static struct xflags {
 	{ FS_XFLAG_FILESTREAM,		"S", "filestream"	},
 	{ FS_XFLAG_DAX,			"x", "dax"		},
 	{ FS_XFLAG_COWEXTSIZE,		"C", "cowextsize"	},
+	{ FS_XFLAG_HASATTR,		"X", "has-xattr"	},

This causes an xfs/207 regression on the extra letter in the output; can you please fix that?

I sent [PATCH] xfs/207: explicitly test for xflag character

but forgot to cc xfs list. it's on the fstests list, sorry!

-Eric