linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v14 0/4] ext4: add project quota support
@ 2015-04-22 18:56 Li Xi
  2015-04-22 18:56 ` [v14 2/4] ext4: adds " Li Xi
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Li Xi @ 2015-04-22 18:56 UTC (permalink / raw)
  To: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
	linux-ext4-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, tytso-3s7WtUTddSA,
	adilger-m1MBpc4rdrD3fQ9qLvQP4Q, jack-AlSwsSmVLrQ,
	viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn,
	hch-wEGCiKHe2LqWVfeAwA7xHQ, dmonakhov-GEFAQzZX7r8dnm+yROfE0A

The following patches propose an implementation of project quota
support for ext4. A project is an aggregate of unrelated inodes
which might scatter in different directories. Inodes that belong
to the same project possess an identical identification i.e.
'project ID', just like every inode has its user/group
identification. The following patches add project quota as
supplement to the former uer/group quota types.

The semantics of ext4 project quota is consistent with XFS. Each
directory can have EXT4_INODE_PROJINHERIT flag set. When the
EXT4_INODE_PROJINHERIT flag of a parent directory is not set, a
newly created inode under that directory will have a default project
ID (i.e. 0). And its EXT4_INODE_PROJINHERIT flag is not set either.
When this flag is set on a directory, following rules will be kept:

1) The newly created inode under that directory will inherit both
the EXT4_INODE_PROJINHERIT flag and the project ID from its parent
directory.

2) Hard-linking a inode with different project ID into that directory
will fail with errno EXDEV.

3) Renaming a inode with different project ID into that directory
will fail with errno EXDEV. However, 'mv' command will detect this
failure and copy the renamed inode to a new inode in the directory.
Thus, this new inode will inherit both the project ID and
EXT4_INODE_PROJINHERIT flag.

4) If the project quota of that ID is being enforced, statfs() on
that directory will take the quotas as another upper limits along
with the capacity of the file system, i.e. the total block/inode
number will be the minimum of the quota limits and file system
capacity.

Changelog:
* v14 <- v13:
 - Cleanup ioctl of setting project ID;
 - Do not check project quota inode number specially;
 - Check isize when extract project ID from disk;
 - Rebase to latest kernel (4.0.0)
* v13 <- v12:
 - Update inode size check of project ID.
* v12 <- v11:
 - Relax the permission check when setting project ID.
* v11 <- v10:
 - Remove project quota mount option;
 - Fix permission check when setting project ID.
* v10 <- v9:
 - Remove non-journaled project quota interface;
 - Only allow admin to read project quota info;
 - Cleanup FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface.
* v9 <- v8:
 - Remove non-journaled project quota;
 - Rebase to newest dev branch of ext4 repository (3.19.0-rc3).
* v8 <- v7:
 - Rebase to newest dev branch of ext4 repository (3.18.0_rc3).
* v7 <- v6:
 - Map ext4 inode flags to xflags of struct fsxattr;
 - Add patch to cleanup ext4 inode flag definitions.
* v6 <- v5:
 - Add project ID check for cross rename;
 - Remove patch of EXT4_IOC_GETPROJECT/EXT4_IOC_SETPROJECT ioctl
* v5 <- v4:
 - Check project feature when set/get project ID;
 - Do not check project feature for project quota;
 - Add support of FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR.
* v4 <- v3:
 - Do not check project feature when set/get project ID;
 - Use EXT4_MAXQUOTAS instead of MAXQUOTAS in ext4 patches;
 - Remove unnecessary change of fs/quota/dquot.c;
 - Remove CONFIG_QUOTA_PROJECT.
* v3 <- v2:
 - Add EXT4_INODE_PROJINHERIT semantics.
* v2 <- v1:
 - Add ioctl interface for setting/getting project;
 - Add EXT4_FEATURE_RO_COMPAT_PROJECT;
 - Add get_projid() method in struct dquot_operations;
 - Add error check of ext4_inode_projid_set/get().

v13: http://www.spinics.net/lists/linux-fsdevel/msg85205.html
v12: http://www.spinics.net/lists/linux-fsdevel/msg84905.html
v11: http://www.spinics.net/lists/linux-ext4/msg47450.html
v10: http://www.spinics.net/lists/linux-ext4/msg47413.html
v9: http://www.spinics.net/lists/linux-ext4/msg47326.html
v8: http://www.spinics.net/lists/linux-ext4/msg46545.html
v7: http://www.spinics.net/lists/linux-fsdevel/msg80404.html
v6: http://www.spinics.net/lists/linux-fsdevel/msg80022.html
v5: http://www.spinics.net/lists/linux-api/msg04840.html
v4: http://lwn.net/Articles/612972/
v3: http://www.spinics.net/lists/linux-ext4/msg45184.html
v2: http://www.spinics.net/lists/linux-ext4/msg44695.html
v1: http://article.gmane.org/gmane.comp.file-systems.ext4/45153

Any comments or feedbacks are appreciated.

Regards,
                                         - Li Xi

Li Xi (4):
  ext4: adds project ID support
  ext4: adds project quota support
  ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
  ext4: cleanup inode flag definitions

 fs/ext4/ext4.h          |   85 +++++++----
 fs/ext4/ialloc.c        |    5 +
 fs/ext4/inode.c         |   28 ++++
 fs/ext4/ioctl.c         |  367 ++++++++++++++++++++++++++++++++++++-----------
 fs/ext4/namei.c         |   20 +++
 fs/ext4/super.c         |   57 +++++++-
 fs/xfs/libxfs/xfs_fs.h  |   47 +++----
 include/uapi/linux/fs.h |   33 +++++
 8 files changed, 489 insertions(+), 153 deletions(-)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [v14 1/4] ext4: adds project ID support
       [not found] ` <1429728997-21464-1-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
@ 2015-04-22 18:56   ` Li Xi
  2015-04-22 18:56   ` [v14 4/4] ext4: cleanup inode flag definitions Li Xi
  2015-04-22 19:45   ` [v14 0/4] ext4: add project quota support Andreas Dilger
  2 siblings, 0 replies; 16+ messages in thread
From: Li Xi @ 2015-04-22 18:56 UTC (permalink / raw)
  To: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
	linux-ext4-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, tytso-3s7WtUTddSA,
	adilger-m1MBpc4rdrD3fQ9qLvQP4Q, jack-AlSwsSmVLrQ,
	viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn,
	hch-wEGCiKHe2LqWVfeAwA7xHQ, dmonakhov-GEFAQzZX7r8dnm+yROfE0A

This patch adds a new internal field of ext4 inode to save project
identifier. Also a new flag EXT4_INODE_PROJINHERIT is added for
inheriting project ID from parent directory.

Signed-off-by: Li Xi <lixi-LfVdkaOWEx8@public.gmane.org>
Reviewed-by: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>
---
 fs/ext4/ext4.h          |   21 +++++++++++++++++----
 fs/ext4/ialloc.c        |    5 +++++
 fs/ext4/inode.c         |   28 ++++++++++++++++++++++++++++
 fs/ext4/namei.c         |   20 ++++++++++++++++++++
 fs/ext4/super.c         |    1 +
 include/uapi/linux/fs.h |    1 +
 6 files changed, 72 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index ef267ad..ebcc91e 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -378,16 +378,18 @@ struct flex_groups {
 #define EXT4_EA_INODE_FL	        0x00200000 /* Inode used for large EA */
 #define EXT4_EOFBLOCKS_FL		0x00400000 /* Blocks allocated beyond EOF */
 #define EXT4_INLINE_DATA_FL		0x10000000 /* Inode has inline data. */
+#define EXT4_PROJINHERIT_FL		0x20000000 /* Create with parents projid */
 #define EXT4_RESERVED_FL		0x80000000 /* reserved for ext4 lib */
 
-#define EXT4_FL_USER_VISIBLE		0x004BDFFF /* User visible flags */
-#define EXT4_FL_USER_MODIFIABLE		0x004380FF /* User modifiable flags */
+#define EXT4_FL_USER_VISIBLE		0x304BDFFF /* User visible flags */
+#define EXT4_FL_USER_MODIFIABLE		0x204380FF /* User modifiable flags */
 
 /* Flags that should be inherited by new inodes from their parent. */
 #define EXT4_FL_INHERITED (EXT4_SECRM_FL | EXT4_UNRM_FL | EXT4_COMPR_FL |\
 			   EXT4_SYNC_FL | EXT4_NODUMP_FL | EXT4_NOATIME_FL |\
 			   EXT4_NOCOMPR_FL | EXT4_JOURNAL_DATA_FL |\
-			   EXT4_NOTAIL_FL | EXT4_DIRSYNC_FL)
+			   EXT4_NOTAIL_FL | EXT4_DIRSYNC_FL |\
+			   EXT4_PROJINHERIT_FL)
 
 /* Flags that are appropriate for regular files (all but dir-specific ones). */
 #define EXT4_REG_FLMASK (~(EXT4_DIRSYNC_FL | EXT4_TOPDIR_FL))
@@ -435,6 +437,7 @@ enum {
 	EXT4_INODE_EA_INODE	= 21,	/* Inode used for large EA */
 	EXT4_INODE_EOFBLOCKS	= 22,	/* Blocks allocated beyond EOF */
 	EXT4_INODE_INLINE_DATA	= 28,	/* Data in inode. */
+	EXT4_INODE_PROJINHERIT	= 29,	/* Create with parents projid */
 	EXT4_INODE_RESERVED	= 31,	/* reserved for ext4 lib */
 };
 
@@ -696,6 +699,7 @@ struct ext4_inode {
 	__le32  i_crtime;       /* File Creation time */
 	__le32  i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */
 	__le32  i_version_hi;	/* high 32 bits for 64-bit version */
+	__le32  i_projid;	/* Project ID */
 };
 
 struct move_extent {
@@ -956,6 +960,7 @@ struct ext4_inode_info {
 	/* Encryption params */
 	struct ext4_encryption_key i_encryption_key;
 #endif
+	kprojid_t i_projid;
 };
 
 /*
@@ -1582,6 +1587,7 @@ static inline int ext4_encrypted_inode(struct inode *inode)
  */
 #define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM	0x0400
 #define EXT4_FEATURE_RO_COMPAT_READONLY		0x1000
+#define EXT4_FEATURE_RO_COMPAT_PROJECT		0x2000
 
 #define EXT4_FEATURE_INCOMPAT_COMPRESSION	0x0001
 #define EXT4_FEATURE_INCOMPAT_FILETYPE		0x0002
@@ -1633,7 +1639,8 @@ static inline int ext4_encrypted_inode(struct inode *inode)
 					 EXT4_FEATURE_RO_COMPAT_HUGE_FILE |\
 					 EXT4_FEATURE_RO_COMPAT_BIGALLOC |\
 					 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM|\
-					 EXT4_FEATURE_RO_COMPAT_QUOTA)
+					 EXT4_FEATURE_RO_COMPAT_QUOTA |\
+					 EXT4_FEATURE_RO_COMPAT_PROJECT)
 
 /*
  * Default values for user and/or group using reserved blocks
@@ -1641,6 +1648,11 @@ static inline int ext4_encrypted_inode(struct inode *inode)
 #define	EXT4_DEF_RESUID		0
 #define	EXT4_DEF_RESGID		0
 
+/*
+ * Default project ID
+ */
+#define	EXT4_DEF_PROJID		0
+
 #define EXT4_DEF_INODE_READAHEAD_BLKS	32
 
 /*
@@ -2290,6 +2302,7 @@ extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode,
 			     loff_t lstart, loff_t lend);
 extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
 extern qsize_t *ext4_get_reserved_space(struct inode *inode);
+extern int ext4_get_projid(struct inode *inode, kprojid_t *projid);
 extern void ext4_da_update_reserve_space(struct inode *inode,
 					int used, int quota_claim);
 
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 2cf18a2..57b43f7 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -755,6 +755,11 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
 		inode->i_gid = dir->i_gid;
 	} else
 		inode_init_owner(inode, dir, mode);
+	if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_PROJECT) &&
+	    ext4_test_inode_flag(dir, EXT4_INODE_PROJINHERIT))
+		ei->i_projid = EXT4_I(dir)->i_projid;
+	else
+		ei->i_projid = make_kprojid(&init_user_ns, EXT4_DEF_PROJID);
 	dquot_initialize(inode);
 
 	if (!goal)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 366476e..f1df729 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4016,6 +4016,14 @@ static inline void ext4_iget_extra_inode(struct inode *inode,
 		EXT4_I(inode)->i_inline_off = 0;
 }
 
+int ext4_get_projid(struct inode *inode, kprojid_t *projid)
+{
+	if (!EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, EXT4_FEATURE_RO_COMPAT_PROJECT))
+		return -EOPNOTSUPP;
+	*projid = EXT4_I(inode)->i_projid;
+	return 0;
+}
+
 struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
 {
 	struct ext4_iloc iloc;
@@ -4027,6 +4035,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
 	int block;
 	uid_t i_uid;
 	gid_t i_gid;
+	projid_t i_projid;
 
 	inode = iget_locked(sb, ino);
 	if (!inode)
@@ -4076,12 +4085,20 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
 	inode->i_mode = le16_to_cpu(raw_inode->i_mode);
 	i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
 	i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
+	if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_PROJECT) &&
+	    EXT4_INODE_SIZE(sb) > EXT4_GOOD_OLD_INODE_SIZE &&
+	    EXT4_FITS_IN_INODE(raw_inode, ei, i_projid))
+		i_projid = (projid_t)le32_to_cpu(raw_inode->i_projid);
+	else
+		i_projid = EXT4_DEF_PROJID;
+
 	if (!(test_opt(inode->i_sb, NO_UID32))) {
 		i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
 		i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
 	}
 	i_uid_write(inode, i_uid);
 	i_gid_write(inode, i_gid);
+	ei->i_projid = make_kprojid(&init_user_ns, i_projid);;
 	set_nlink(inode, le16_to_cpu(raw_inode->i_links_count));
 
 	ext4_clear_state_flags(ei);	/* Only relevant on 32-bit archs */
@@ -4371,6 +4388,7 @@ static int ext4_do_update_inode(handle_t *handle,
 	int need_datasync = 0, set_large_file = 0;
 	uid_t i_uid;
 	gid_t i_gid;
+	projid_t i_projid;
 
 	spin_lock(&ei->i_raw_lock);
 
@@ -4383,6 +4401,7 @@ static int ext4_do_update_inode(handle_t *handle,
 	raw_inode->i_mode = cpu_to_le16(inode->i_mode);
 	i_uid = i_uid_read(inode);
 	i_gid = i_gid_read(inode);
+	i_projid = from_kprojid(&init_user_ns, ei->i_projid);
 	if (!(test_opt(inode->i_sb, NO_UID32))) {
 		raw_inode->i_uid_low = cpu_to_le16(low_16_bits(i_uid));
 		raw_inode->i_gid_low = cpu_to_le16(low_16_bits(i_gid));
@@ -4461,6 +4480,15 @@ static int ext4_do_update_inode(handle_t *handle,
 				cpu_to_le16(ei->i_extra_isize);
 		}
 	}
+
+	BUG_ON(!EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb,
+			EXT4_FEATURE_RO_COMPAT_PROJECT) &&
+	       i_projid != EXT4_DEF_PROJID);
+
+	if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE &&
+	    EXT4_FITS_IN_INODE(raw_inode, ei, i_projid))
+		raw_inode->i_projid = cpu_to_le32(i_projid);
+
 	ext4_inode_csum_set(inode, raw_inode, ei);
 	spin_unlock(&ei->i_raw_lock);
 	if (inode->i_sb->s_flags & MS_LAZYTIME)
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index ef22cd9..cc20472 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -3344,9 +3344,16 @@ static int ext4_link(struct dentry *old_dentry,
 
 	if (inode->i_nlink >= EXT4_LINK_MAX)
 		return -EMLINK;
+
 	if (ext4_encrypted_inode(dir) &&
 	    !ext4_is_child_context_consistent_with_parent(dir, inode))
 		return -EPERM;
+
+	if ((ext4_test_inode_flag(dir, EXT4_INODE_PROJINHERIT)) &&
+	    (!projid_eq(EXT4_I(dir)->i_projid,
+			EXT4_I(old_dentry->d_inode)->i_projid)))
+		return -EXDEV;
+
 	dquot_initialize(dir);
 
 retry:
@@ -3626,6 +3633,11 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
 	int credits;
 	u8 old_file_type;
 
+	if ((ext4_test_inode_flag(new_dir, EXT4_INODE_PROJINHERIT)) &&
+	    (!projid_eq(EXT4_I(new_dir)->i_projid,
+			EXT4_I(old_dentry->d_inode)->i_projid)))
+		return -EXDEV;
+
 	dquot_initialize(old.dir);
 	dquot_initialize(new.dir);
 
@@ -3819,6 +3831,14 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
 	u8 new_file_type;
 	int retval;
 
+	if ((ext4_test_inode_flag(new_dir, EXT4_INODE_PROJINHERIT) &&
+	     !projid_eq(EXT4_I(new_dir)->i_projid,
+			EXT4_I(old_dentry->d_inode)->i_projid)) ||
+	    (ext4_test_inode_flag(old_dir, EXT4_INODE_PROJINHERIT) &&
+	     !projid_eq(EXT4_I(old_dir)->i_projid,
+			EXT4_I(new_dentry->d_inode)->i_projid)))
+		return -EXDEV;
+
 	dquot_initialize(old.dir);
 	dquot_initialize(new.dir);
 
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 821f22d..45558c9 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1056,6 +1056,7 @@ static const struct dquot_operations ext4_quota_operations = {
 	.write_info	= ext4_write_info,
 	.alloc_dquot	= dquot_alloc,
 	.destroy_dquot	= dquot_destroy,
+	.get_projid	= ext4_get_projid,
 };
 
 static const struct quotactl_ops ext4_qctl_operations = {
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index 9b964a5..f15d980 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -197,6 +197,7 @@ struct inodes_stat_t {
 #define FS_EXTENT_FL			0x00080000 /* Extents */
 #define FS_DIRECTIO_FL			0x00100000 /* Use direct i/o */
 #define FS_NOCOW_FL			0x00800000 /* Do not cow file */
+#define FS_PROJINHERIT_FL		0x20000000 /* Create with parents projid */
 #define FS_RESERVED_FL			0x80000000 /* reserved for ext2 lib */
 
 #define FS_FL_USER_VISIBLE		0x0003DFFF /* User visible flags */
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [v14 2/4] ext4: adds project quota support
  2015-04-22 18:56 [v14 0/4] ext4: add project quota support Li Xi
@ 2015-04-22 18:56 ` Li Xi
  2015-04-22 18:56 ` [v14 3/4] ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support Li Xi
       [not found] ` <1429728997-21464-1-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
  2 siblings, 0 replies; 16+ messages in thread
From: Li Xi @ 2015-04-22 18:56 UTC (permalink / raw)
  To: linux-fsdevel, linux-ext4, linux-api, tytso, adilger, jack, viro,
	hch, dmonakhov

This patch adds mount options for enabling/disabling project quota
accounting and enforcement. A new specific inode is also used for
project quota accounting.

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Jan Kara <jack@suse.cz>
---
 fs/ext4/ext4.h  |    5 ++-
 fs/ext4/super.c |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 54 insertions(+), 7 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index ebcc91e..0729a42 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1194,7 +1194,8 @@ struct ext4_super_block {
 	__u8	s_encrypt_algos[4];	/* Encryption algorithms in use  */
 	__u8	s_encrypt_pw_salt[16];	/* Salt used for string2key algorithm */
 	__le32	s_lpf_ino;		/* Location of the lost+found inode */
-	__le32	s_reserved[100];	/* Padding to the end of the block */
+	__le32	s_prj_quota_inum;	/* inode for tracking project quota */
+	__le32	s_reserved[99];		/* Padding to the end of the block */
 	__le32	s_checksum;		/* crc32c(superblock) */
 };
 
@@ -1217,7 +1218,7 @@ struct ext4_super_block {
 #endif
 
 /* Number of quota types we support */
-#define EXT4_MAXQUOTAS 2
+#define EXT4_MAXQUOTAS 3
 
 /*
  * fourth extended-fs super-block data in memory
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 45558c9..c61bb6b 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1022,8 +1022,8 @@ static int bdev_try_to_free_page(struct super_block *sb, struct page *page,
 }
 
 #ifdef CONFIG_QUOTA
-#define QTYPE2NAME(t) ((t) == USRQUOTA ? "user" : "group")
-#define QTYPE2MOPT(on, t) ((t) == USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA))
+static char *quotatypes[] = INITQFNAMES;
+#define QTYPE2NAME(t) (quotatypes[t])
 
 static int ext4_write_dquot(struct dquot *dquot);
 static int ext4_acquire_dquot(struct dquot *dquot);
@@ -3976,7 +3976,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		sb->s_qcop = &dquot_quotactl_sysfile_ops;
 	else
 		sb->s_qcop = &ext4_qctl_operations;
-	sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP;
+	sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;
 #endif
 	memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
 
@@ -5092,6 +5092,46 @@ restore_opts:
 	return err;
 }
 
+static int ext4_statfs_project(struct super_block *sb,
+			       kprojid_t projid, struct kstatfs *buf)
+{
+	struct kqid qid;
+	struct dquot *dquot;
+	u64 limit;
+	u64 curblock;
+
+	qid = make_kqid_projid(projid);
+	dquot = dqget(sb, qid);
+	if (!dquot)
+		return -ESRCH;
+	spin_lock(&dq_data_lock);
+
+	limit = dquot->dq_dqb.dqb_bsoftlimit ?
+		dquot->dq_dqb.dqb_bsoftlimit :
+		dquot->dq_dqb.dqb_bhardlimit;
+	if (limit && buf->f_blocks * buf->f_bsize > limit) {
+		curblock = dquot->dq_dqb.dqb_curspace / buf->f_bsize;
+		buf->f_blocks = limit / buf->f_bsize;
+		buf->f_bfree = buf->f_bavail =
+			(buf->f_blocks > curblock) ?
+			 (buf->f_blocks - curblock) : 0;
+	}
+
+	limit = dquot->dq_dqb.dqb_isoftlimit ?
+		dquot->dq_dqb.dqb_isoftlimit :
+		dquot->dq_dqb.dqb_ihardlimit;
+	if (limit && buf->f_files > limit) {
+		buf->f_files = limit;
+		buf->f_ffree =
+			(buf->f_files > dquot->dq_dqb.dqb_curinodes) ?
+			 (buf->f_files - dquot->dq_dqb.dqb_curinodes) : 0;
+	}
+
+	spin_unlock(&dq_data_lock);
+	dqput(dquot);
+	return 0;
+}
+
 static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
 	struct super_block *sb = dentry->d_sb;
@@ -5100,6 +5140,7 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
 	ext4_fsblk_t overhead = 0, resv_blocks;
 	u64 fsid;
 	s64 bfree;
+	struct inode *inode = dentry->d_inode;
 	resv_blocks = EXT4_C2B(sbi, atomic64_read(&sbi->s_resv_clusters));
 
 	if (!test_opt(sb, MINIX_DF))
@@ -5124,6 +5165,9 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
 	buf->f_fsid.val[0] = fsid & 0xFFFFFFFFUL;
 	buf->f_fsid.val[1] = (fsid >> 32) & 0xFFFFFFFFUL;
 
+	if (ext4_test_inode_flag(inode, EXT4_INODE_PROJINHERIT) &&
+	    sb_has_quota_limits_enabled(sb, PRJQUOTA))
+		ext4_statfs_project(sb, EXT4_I(inode)->i_projid, buf);
 	return 0;
 }
 
@@ -5288,7 +5332,8 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
 	struct inode *qf_inode;
 	unsigned long qf_inums[EXT4_MAXQUOTAS] = {
 		le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum),
-		le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum)
+		le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum),
+		le32_to_cpu(EXT4_SB(sb)->s_es->s_prj_quota_inum)
 	};
 
 	BUG_ON(!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA));
@@ -5316,7 +5361,8 @@ static int ext4_enable_quotas(struct super_block *sb)
 	int type, err = 0;
 	unsigned long qf_inums[EXT4_MAXQUOTAS] = {
 		le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum),
-		le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum)
+		le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum),
+		le32_to_cpu(EXT4_SB(sb)->s_es->s_prj_quota_inum)
 	};
 
 	sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [v14 3/4] ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
  2015-04-22 18:56 [v14 0/4] ext4: add project quota support Li Xi
  2015-04-22 18:56 ` [v14 2/4] ext4: adds " Li Xi
@ 2015-04-22 18:56 ` Li Xi
  2015-04-24 16:40   ` Jan Kara
       [not found]   ` <1429728997-21464-4-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
       [not found] ` <1429728997-21464-1-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
  2 siblings, 2 replies; 16+ messages in thread
From: Li Xi @ 2015-04-22 18:56 UTC (permalink / raw)
  To: linux-fsdevel, linux-ext4, linux-api, tytso, adilger, jack, viro,
	hch, dmonakhov

This patch adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR ioctl interface
support for ext4. The interface is kept consistent with
XFS_IOC_FSGETXATTR/XFS_IOC_FSGETXATTR.

Signed-off-by: Li Xi <lixi@ddn.com>
---
 fs/ext4/ext4.h          |    9 ++
 fs/ext4/ioctl.c         |  367 ++++++++++++++++++++++++++++++++++++-----------
 fs/xfs/libxfs/xfs_fs.h  |   47 +++----
 include/uapi/linux/fs.h |   32 ++++
 4 files changed, 338 insertions(+), 117 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 0729a42..9995c53 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -384,6 +384,13 @@ struct flex_groups {
 #define EXT4_FL_USER_VISIBLE		0x304BDFFF /* User visible flags */
 #define EXT4_FL_USER_MODIFIABLE		0x204380FF /* User modifiable flags */
 
+#define EXT4_FL_XFLAG_VISIBLE		(EXT4_SYNC_FL | \
+					 EXT4_IMMUTABLE_FL | \
+					 EXT4_APPEND_FL | \
+					 EXT4_NODUMP_FL | \
+					 EXT4_NOATIME_FL | \
+					 EXT4_PROJINHERIT_FL)
+
 /* Flags that should be inherited by new inodes from their parent. */
 #define EXT4_FL_INHERITED (EXT4_SECRM_FL | EXT4_UNRM_FL | EXT4_COMPR_FL |\
 			   EXT4_SYNC_FL | EXT4_NODUMP_FL | EXT4_NOATIME_FL |\
@@ -618,6 +625,8 @@ enum {
 #define EXT4_IOC_SET_ENCRYPTION_POLICY	_IOR('f', 19, struct ext4_encryption_policy)
 #define EXT4_IOC_GET_ENCRYPTION_PWSALT	_IOW('f', 20, __u8[16])
 #define EXT4_IOC_GET_ENCRYPTION_POLICY	_IOW('f', 21, struct ext4_encryption_policy)
+#define EXT4_IOC_FSGETXATTR		FS_IOC_FSGETXATTR
+#define EXT4_IOC_FSSETXATTR		FS_IOC_FSSETXATTR
 
 #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
 /*
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 2cb9e17..100b774 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -14,6 +14,7 @@
 #include <linux/mount.h>
 #include <linux/file.h>
 #include <linux/random.h>
+#include <linux/quotaops.h>
 #include <asm/uaccess.h>
 #include "ext4_jbd2.h"
 #include "ext4.h"
@@ -206,6 +207,229 @@ static int uuid_is_zero(__u8 u[16])
 	return 1;
 }
 
+static int ext4_ioctl_setflags(struct inode *inode,
+			       unsigned int flags)
+{
+	struct ext4_inode_info *ei = EXT4_I(inode);
+	handle_t *handle = NULL;
+	int err = EPERM, migrate = 0;
+	struct ext4_iloc iloc;
+	unsigned int oldflags, mask, i;
+	unsigned int jflag;
+
+	/* Is it quota file? Do not allow user to mess with it */
+	if (IS_NOQUOTA(inode))
+		goto flags_out;
+
+	oldflags = ei->i_flags;
+
+	/* The JOURNAL_DATA flag is modifiable only by root */
+	jflag = flags & EXT4_JOURNAL_DATA_FL;
+
+	/*
+	 * The IMMUTABLE and APPEND_ONLY flags can only be changed by
+	 * the relevant capability.
+	 *
+	 * This test looks nicer. Thanks to Pauline Middelink
+	 */
+	if ((flags ^ oldflags) & (EXT4_APPEND_FL | EXT4_IMMUTABLE_FL)) {
+		if (!capable(CAP_LINUX_IMMUTABLE))
+			goto flags_out;
+	}
+
+	/*
+	 * The JOURNAL_DATA flag can only be changed by
+	 * the relevant capability.
+	 */
+	if ((jflag ^ oldflags) & (EXT4_JOURNAL_DATA_FL)) {
+		if (!capable(CAP_SYS_RESOURCE))
+			goto flags_out;
+	}
+	if ((flags ^ oldflags) & EXT4_EXTENTS_FL)
+		migrate = 1;
+
+	if (flags & EXT4_EOFBLOCKS_FL) {
+		/* we don't support adding EOFBLOCKS flag */
+		if (!(oldflags & EXT4_EOFBLOCKS_FL)) {
+			err = -EOPNOTSUPP;
+			goto flags_out;
+		}
+	} else if (oldflags & EXT4_EOFBLOCKS_FL)
+		ext4_truncate(inode);
+
+	handle = ext4_journal_start(inode, EXT4_HT_INODE, 1);
+	if (IS_ERR(handle)) {
+		err = PTR_ERR(handle);
+		goto flags_out;
+	}
+	if (IS_SYNC(inode))
+		ext4_handle_sync(handle);
+	err = ext4_reserve_inode_write(handle, inode, &iloc);
+	if (err)
+		goto flags_err;
+
+	for (i = 0, mask = 1; i < 32; i++, mask <<= 1) {
+		if (!(mask & EXT4_FL_USER_MODIFIABLE))
+			continue;
+		if (mask & flags)
+			ext4_set_inode_flag(inode, i);
+		else
+			ext4_clear_inode_flag(inode, i);
+	}
+
+	ext4_set_inode_flags(inode);
+	inode->i_ctime = ext4_current_time(inode);
+
+	err = ext4_mark_iloc_dirty(handle, inode, &iloc);
+flags_err:
+	ext4_journal_stop(handle);
+	if (err)
+		goto flags_out;
+
+	if ((jflag ^ oldflags) & (EXT4_JOURNAL_DATA_FL))
+		err = ext4_change_inode_journal_flag(inode, jflag);
+	if (err)
+		goto flags_out;
+	if (migrate) {
+		if (flags & EXT4_EXTENTS_FL)
+			err = ext4_ext_migrate(inode);
+		else
+			err = ext4_ind_migrate(inode);
+	}
+
+flags_out:
+	return err;
+}
+
+static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
+{
+	struct inode *inode = file_inode(filp);
+	struct super_block *sb = inode->i_sb;
+	struct ext4_inode_info *ei = EXT4_I(inode);
+	int err, rc;
+	handle_t *handle;
+	kprojid_t kprojid;
+	struct ext4_iloc iloc;
+	struct ext4_inode *raw_inode;
+	struct dquot *transfer_to[EXT4_MAXQUOTAS] = { };
+
+	if (!EXT4_HAS_RO_COMPAT_FEATURE(sb,
+			EXT4_FEATURE_RO_COMPAT_PROJECT)) {
+		BUG_ON(__kprojid_val(EXT4_I(inode)->i_projid)
+		       != EXT4_DEF_PROJID);
+		if (projid != EXT4_DEF_PROJID)
+			return -EOPNOTSUPP;
+		else
+			return 0;
+	}
+
+	if (EXT4_INODE_SIZE(sb) <= EXT4_GOOD_OLD_INODE_SIZE)
+	    	return -EOPNOTSUPP;
+
+	kprojid = make_kprojid(&init_user_ns, (projid_t)projid);
+
+	if (projid_eq(kprojid, EXT4_I(inode)->i_projid))
+		return 0;
+
+	err = mnt_want_write_file(filp);
+	if (err)
+		return err;
+
+	err = -EPERM;
+	mutex_lock(&inode->i_mutex);
+	/* Is it quota file? Do not allow user to mess with it */
+	if (IS_NOQUOTA(inode))
+		goto out_unlock;
+
+	err = ext4_get_inode_loc(inode, &iloc);
+	if (err)
+		goto out_unlock;
+
+	raw_inode = ext4_raw_inode(&iloc);
+	if (!EXT4_FITS_IN_INODE(raw_inode, ei, i_projid)) {
+	    	err = -EOVERFLOW;
+	    	brelse(iloc.bh);
+	    	goto out_unlock;
+	}
+	brelse(iloc.bh);
+
+	dquot_initialize(inode);
+
+	handle = ext4_journal_start(inode, EXT4_HT_QUOTA,
+		EXT4_QUOTA_INIT_BLOCKS(sb) +
+		EXT4_QUOTA_DEL_BLOCKS(sb) + 3);
+	if (IS_ERR(handle)) {
+		err = PTR_ERR(handle);
+		goto out_unlock;
+	}
+
+	err = ext4_reserve_inode_write(handle, inode, &iloc);
+	if (err)
+		goto out_stop;
+
+	transfer_to[PRJQUOTA] = dqget(sb, make_kqid_projid(kprojid));
+	if (transfer_to[PRJQUOTA]) {
+		err = __dquot_transfer(inode, transfer_to);
+		dqput(transfer_to[PRJQUOTA]);
+		if (err)
+			goto out_dirty;
+	}
+
+	EXT4_I(inode)->i_projid = kprojid;
+	inode->i_ctime = ext4_current_time(inode);
+out_dirty:
+	rc = ext4_mark_iloc_dirty(handle, inode, &iloc);
+	if (!err)
+		err = rc;
+out_stop:
+	ext4_journal_stop(handle);
+out_unlock:
+	mutex_unlock(&inode->i_mutex);
+	mnt_drop_write_file(filp);
+	return err;
+}
+
+/* Transfer internal flags to xflags */
+static inline __u32 ext4_iflags_to_xflags(unsigned long iflags)
+{
+	__u32 xflags = 0;
+
+	if (iflags & EXT4_SYNC_FL)
+		xflags |= FS_XFLAG_SYNC;
+	if (iflags & EXT4_IMMUTABLE_FL)
+		xflags |= FS_XFLAG_IMMUTABLE;
+	if (iflags & EXT4_APPEND_FL)
+		xflags |= FS_XFLAG_APPEND;
+	if (iflags & EXT4_NODUMP_FL)
+		xflags |= FS_XFLAG_NODUMP;
+	if (iflags & EXT4_NOATIME_FL)
+		xflags |= FS_XFLAG_NOATIME;
+	if (iflags & EXT4_PROJINHERIT_FL)
+		xflags |= FS_XFLAG_PROJINHERIT;
+	return xflags;
+}
+
+/* Transfer xflags flags to internal */
+static inline unsigned long ext4_xflags_to_iflags(__u32 xflags)
+{
+	unsigned long iflags = 0;
+
+	if (xflags & FS_XFLAG_SYNC)
+		iflags |= EXT4_SYNC_FL;
+	if (xflags & FS_XFLAG_IMMUTABLE)
+		iflags |= EXT4_IMMUTABLE_FL;
+	if (xflags & FS_XFLAG_APPEND)
+		iflags |= EXT4_APPEND_FL;
+	if (xflags & FS_XFLAG_NODUMP)
+		iflags |= EXT4_NODUMP_FL;
+	if (xflags & FS_XFLAG_NOATIME)
+		iflags |= EXT4_NOATIME_FL;
+	if (xflags & FS_XFLAG_PROJINHERIT)
+		iflags |= EXT4_PROJINHERIT_FL;
+
+	return iflags;
+}
+
 long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
 	struct inode *inode = file_inode(filp);
@@ -221,11 +445,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		flags = ei->i_flags & EXT4_FL_USER_VISIBLE;
 		return put_user(flags, (int __user *) arg);
 	case EXT4_IOC_SETFLAGS: {
-		handle_t *handle = NULL;
-		int err, migrate = 0;
-		struct ext4_iloc iloc;
-		unsigned int oldflags, mask, i;
-		unsigned int jflag;
+		int err;
 
 		if (!inode_owner_or_capable(inode))
 			return -EACCES;
@@ -239,89 +459,8 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 
 		flags = ext4_mask_flags(inode->i_mode, flags);
 
-		err = -EPERM;
 		mutex_lock(&inode->i_mutex);
-		/* Is it quota file? Do not allow user to mess with it */
-		if (IS_NOQUOTA(inode))
-			goto flags_out;
-
-		oldflags = ei->i_flags;
-
-		/* The JOURNAL_DATA flag is modifiable only by root */
-		jflag = flags & EXT4_JOURNAL_DATA_FL;
-
-		/*
-		 * The IMMUTABLE and APPEND_ONLY flags can only be changed by
-		 * the relevant capability.
-		 *
-		 * This test looks nicer. Thanks to Pauline Middelink
-		 */
-		if ((flags ^ oldflags) & (EXT4_APPEND_FL | EXT4_IMMUTABLE_FL)) {
-			if (!capable(CAP_LINUX_IMMUTABLE))
-				goto flags_out;
-		}
-
-		/*
-		 * The JOURNAL_DATA flag can only be changed by
-		 * the relevant capability.
-		 */
-		if ((jflag ^ oldflags) & (EXT4_JOURNAL_DATA_FL)) {
-			if (!capable(CAP_SYS_RESOURCE))
-				goto flags_out;
-		}
-		if ((flags ^ oldflags) & EXT4_EXTENTS_FL)
-			migrate = 1;
-
-		if (flags & EXT4_EOFBLOCKS_FL) {
-			/* we don't support adding EOFBLOCKS flag */
-			if (!(oldflags & EXT4_EOFBLOCKS_FL)) {
-				err = -EOPNOTSUPP;
-				goto flags_out;
-			}
-		} else if (oldflags & EXT4_EOFBLOCKS_FL)
-			ext4_truncate(inode);
-
-		handle = ext4_journal_start(inode, EXT4_HT_INODE, 1);
-		if (IS_ERR(handle)) {
-			err = PTR_ERR(handle);
-			goto flags_out;
-		}
-		if (IS_SYNC(inode))
-			ext4_handle_sync(handle);
-		err = ext4_reserve_inode_write(handle, inode, &iloc);
-		if (err)
-			goto flags_err;
-
-		for (i = 0, mask = 1; i < 32; i++, mask <<= 1) {
-			if (!(mask & EXT4_FL_USER_MODIFIABLE))
-				continue;
-			if (mask & flags)
-				ext4_set_inode_flag(inode, i);
-			else
-				ext4_clear_inode_flag(inode, i);
-		}
-
-		ext4_set_inode_flags(inode);
-		inode->i_ctime = ext4_current_time(inode);
-
-		err = ext4_mark_iloc_dirty(handle, inode, &iloc);
-flags_err:
-		ext4_journal_stop(handle);
-		if (err)
-			goto flags_out;
-
-		if ((jflag ^ oldflags) & (EXT4_JOURNAL_DATA_FL))
-			err = ext4_change_inode_journal_flag(inode, jflag);
-		if (err)
-			goto flags_out;
-		if (migrate) {
-			if (flags & EXT4_EXTENTS_FL)
-				err = ext4_ext_migrate(inode);
-			else
-				err = ext4_ind_migrate(inode);
-		}
-
-flags_out:
+		err = ext4_ioctl_setflags(inode, flags);
 		mutex_unlock(&inode->i_mutex);
 		mnt_drop_write_file(filp);
 		return err;
@@ -697,6 +836,60 @@ encryption_policy_out:
 		return -EOPNOTSUPP;
 #endif
 	}
+	case EXT4_IOC_FSGETXATTR:
+	{
+		struct fsxattr fa;
+
+		memset(&fa, 0, sizeof(struct fsxattr));
+		ext4_get_inode_flags(ei);
+		fa.fsx_xflags = ext4_iflags_to_xflags(ei->i_flags & EXT4_FL_USER_VISIBLE);
+
+		if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb,
+				EXT4_FEATURE_RO_COMPAT_PROJECT)) {
+			fa.fsx_projid = (__u32)from_kprojid(&init_user_ns,
+				EXT4_I(inode)->i_projid);
+		}
+
+		if (copy_to_user((struct fsxattr __user *)arg,
+				 &fa, sizeof(fa)))
+			return -EFAULT;
+		return 0;
+	}
+	case EXT4_IOC_FSSETXATTR:
+	{
+		struct fsxattr fa;
+		int err;
+
+		if (copy_from_user(&fa, (struct fsxattr __user *)arg,
+				   sizeof(fa)))
+			return -EFAULT;
+
+		/* Make sure caller has proper permission */
+		if (!inode_owner_or_capable(inode))
+			return -EACCES;
+
+		err = mnt_want_write_file(filp);
+		if (err)
+			return err;
+
+		flags = ext4_xflags_to_iflags(fa.fsx_xflags);
+		flags = ext4_mask_flags(inode->i_mode, flags);
+
+		mutex_lock(&inode->i_mutex);
+		flags = (ei->i_flags & ~EXT4_FL_XFLAG_VISIBLE) |
+			 (flags & EXT4_FL_XFLAG_VISIBLE);
+		err = ext4_ioctl_setflags(inode, flags);
+		mutex_unlock(&inode->i_mutex);
+		mnt_drop_write_file(filp);
+		if (err)
+			return err;
+
+		err = ext4_ioctl_setproject(filp, fa.fsx_projid);
+		if (err)
+			return err;
+
+		return 0;
+	}
 	default:
 		return -ENOTTY;
 	}
diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h
index 18dc721..64c7ae6 100644
--- a/fs/xfs/libxfs/xfs_fs.h
+++ b/fs/xfs/libxfs/xfs_fs.h
@@ -36,38 +36,25 @@ struct dioattr {
 #endif
 
 /*
- * Structure for XFS_IOC_FSGETXATTR[A] and XFS_IOC_FSSETXATTR.
- */
-#ifndef HAVE_FSXATTR
-struct fsxattr {
-	__u32		fsx_xflags;	/* xflags field value (get/set) */
-	__u32		fsx_extsize;	/* extsize field value (get/set)*/
-	__u32		fsx_nextents;	/* nextents field value (get)	*/
-	__u32		fsx_projid;	/* project identifier (get/set) */
-	unsigned char	fsx_pad[12];
-};
-#endif
-
-/*
  * Flags for the bs_xflags/fsx_xflags field
  * There should be a one-to-one correspondence between these flags and the
  * XFS_DIFLAG_s.
  */
-#define XFS_XFLAG_REALTIME	0x00000001	/* data in realtime volume */
-#define XFS_XFLAG_PREALLOC	0x00000002	/* preallocated file extents */
-#define XFS_XFLAG_IMMUTABLE	0x00000008	/* file cannot be modified */
-#define XFS_XFLAG_APPEND	0x00000010	/* all writes append */
-#define XFS_XFLAG_SYNC		0x00000020	/* all writes synchronous */
-#define XFS_XFLAG_NOATIME	0x00000040	/* do not update access time */
-#define XFS_XFLAG_NODUMP	0x00000080	/* do not include in backups */
-#define XFS_XFLAG_RTINHERIT	0x00000100	/* create with rt bit set */
-#define XFS_XFLAG_PROJINHERIT	0x00000200	/* create with parents projid */
-#define XFS_XFLAG_NOSYMLINKS	0x00000400	/* disallow symlink creation */
-#define XFS_XFLAG_EXTSIZE	0x00000800	/* extent size allocator hint */
-#define XFS_XFLAG_EXTSZINHERIT	0x00001000	/* inherit inode extent size */
-#define XFS_XFLAG_NODEFRAG	0x00002000  	/* do not defragment */
-#define XFS_XFLAG_FILESTREAM	0x00004000	/* use filestream allocator */
-#define XFS_XFLAG_HASATTR	0x80000000	/* no DIFLAG for this	*/
+#define XFS_XFLAG_REALTIME	FS_XFLAG_REALTIME	/* data in realtime volume */
+#define XFS_XFLAG_PREALLOC	FS_XFLAG_PREALLOC	/* preallocated file extents */
+#define XFS_XFLAG_IMMUTABLE	FS_XFLAG_IMMUTABLE	/* file cannot be modified */
+#define XFS_XFLAG_APPEND	FS_XFLAG_APPEND		/* all writes append */
+#define XFS_XFLAG_SYNC		FS_XFLAG_SYNC		/* all writes synchronous */
+#define XFS_XFLAG_NOATIME	FS_XFLAG_NOATIME	/* do not update access time */
+#define XFS_XFLAG_NODUMP	FS_XFLAG_NODUMP		/* do not include in backups */
+#define XFS_XFLAG_RTINHERIT	FS_XFLAG_RTINHERIT	/* create with rt bit set */
+#define XFS_XFLAG_PROJINHERIT	FS_XFLAG_PROJINHERIT	/* create with parents projid */
+#define XFS_XFLAG_NOSYMLINKS	FS_XFLAG_NOSYMLINKS	/* disallow symlink creation */
+#define XFS_XFLAG_EXTSIZE	FS_XFLAG_EXTSIZE	/* extent size allocator hint */
+#define XFS_XFLAG_EXTSZINHERIT	FS_XFLAG_EXTSZINHERIT	/* inherit inode extent size */
+#define XFS_XFLAG_NODEFRAG	FS_XFLAG_NODEFRAG  	/* do not defragment */
+#define XFS_XFLAG_FILESTREAM	FS_XFLAG_FILESTREAM	/* use filestream allocator */
+#define XFS_XFLAG_HASATTR	FS_XFLAG_HASATTR	/* no DIFLAG for this	*/
 
 /*
  * Structure for XFS_IOC_GETBMAP.
@@ -503,8 +490,8 @@ typedef struct xfs_swapext
 #define XFS_IOC_ALLOCSP		_IOW ('X', 10, struct xfs_flock64)
 #define XFS_IOC_FREESP		_IOW ('X', 11, struct xfs_flock64)
 #define XFS_IOC_DIOINFO		_IOR ('X', 30, struct dioattr)
-#define XFS_IOC_FSGETXATTR	_IOR ('X', 31, struct fsxattr)
-#define XFS_IOC_FSSETXATTR	_IOW ('X', 32, struct fsxattr)
+#define XFS_IOC_FSGETXATTR	FS_IOC_FSGETXATTR
+#define XFS_IOC_FSSETXATTR	FS_IOC_FSSETXATTR
 #define XFS_IOC_ALLOCSP64	_IOW ('X', 36, struct xfs_flock64)
 #define XFS_IOC_FREESP64	_IOW ('X', 37, struct xfs_flock64)
 #define XFS_IOC_GETBMAP		_IOWR('X', 38, struct getbmap)
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index f15d980..627f58e 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -58,6 +58,36 @@ struct inodes_stat_t {
 	long dummy[5];		/* padding for sysctl ABI compatibility */
 };
 
+/*
+ * Structure for FS_IOC_FSGETXATTR and FS_IOC_FSSETXATTR.
+ */
+struct fsxattr {
+	__u32		fsx_xflags;	/* xflags field value (get/set) */
+	__u32		fsx_extsize;	/* extsize field value (get/set)*/
+	__u32		fsx_nextents;	/* nextents field value (get)	*/
+	__u32		fsx_projid;	/* project identifier (get/set) */
+	unsigned char	fsx_pad[12];
+};
+
+/*
+ * Flags for the fsx_xflags field
+ */
+#define FS_XFLAG_REALTIME	0x00000001	/* data in realtime volume */
+#define FS_XFLAG_PREALLOC	0x00000002	/* preallocated file extents */
+#define FS_XFLAG_IMMUTABLE	0x00000008	/* file cannot be modified */
+#define FS_XFLAG_APPEND		0x00000010	/* all writes append */
+#define FS_XFLAG_SYNC		0x00000020	/* all writes synchronous */
+#define FS_XFLAG_NOATIME	0x00000040	/* do not update access time */
+#define FS_XFLAG_NODUMP		0x00000080	/* do not include in backups */
+#define FS_XFLAG_RTINHERIT	0x00000100	/* create with rt bit set */
+#define FS_XFLAG_PROJINHERIT	0x00000200	/* create with parents projid */
+#define FS_XFLAG_NOSYMLINKS	0x00000400	/* disallow symlink creation */
+#define FS_XFLAG_EXTSIZE	0x00000800	/* extent size allocator hint */
+#define FS_XFLAG_EXTSZINHERIT	0x00001000	/* inherit inode extent size */
+#define FS_XFLAG_NODEFRAG	0x00002000  	/* do not defragment */
+#define FS_XFLAG_FILESTREAM	0x00004000	/* use filestream allocator */
+#define FS_XFLAG_HASATTR	0x80000000	/* no DIFLAG for this */
+
 
 #define NR_FILE  8192	/* this can well be larger on a larger system */
 
@@ -165,6 +195,8 @@ struct inodes_stat_t {
 #define	FS_IOC_GETVERSION		_IOR('v', 1, long)
 #define	FS_IOC_SETVERSION		_IOW('v', 2, long)
 #define FS_IOC_FIEMAP			_IOWR('f', 11, struct fiemap)
+#define FS_IOC_FSGETXATTR		_IOR('X', 31, struct fsxattr)
+#define FS_IOC_FSSETXATTR		_IOW('X', 32, struct fsxattr)
 #define FS_IOC32_GETFLAGS		_IOR('f', 1, int)
 #define FS_IOC32_SETFLAGS		_IOW('f', 2, int)
 #define FS_IOC32_GETVERSION		_IOR('v', 1, int)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [v14 4/4] ext4: cleanup inode flag definitions
       [not found] ` <1429728997-21464-1-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
  2015-04-22 18:56   ` [v14 1/4] ext4: adds project ID support Li Xi
@ 2015-04-22 18:56   ` Li Xi
  2015-04-22 19:45   ` [v14 0/4] ext4: add project quota support Andreas Dilger
  2 siblings, 0 replies; 16+ messages in thread
From: Li Xi @ 2015-04-22 18:56 UTC (permalink / raw)
  To: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
	linux-ext4-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, tytso-3s7WtUTddSA,
	adilger-m1MBpc4rdrD3fQ9qLvQP4Q, jack-AlSwsSmVLrQ,
	viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn,
	hch-wEGCiKHe2LqWVfeAwA7xHQ, dmonakhov-GEFAQzZX7r8dnm+yROfE0A

The inode flags defined in uapi/linux/fs.h were migrated from
ext4.h. This patch changes the inode flag definitions in ext4.h
to VFS definitions to make the gaps between them clearer.

Signed-off-by: Li Xi <lixi-LfVdkaOWEx8@public.gmane.org>
Reviewed-by: Andreas Dilger <adilger-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org>
---
 fs/ext4/ext4.h |   50 +++++++++++++++++++++++++-------------------------
 1 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 9995c53..f7ddf53 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -352,34 +352,34 @@ struct flex_groups {
 /*
  * Inode flags
  */
-#define	EXT4_SECRM_FL			0x00000001 /* Secure deletion */
-#define	EXT4_UNRM_FL			0x00000002 /* Undelete */
-#define	EXT4_COMPR_FL			0x00000004 /* Compress file */
-#define EXT4_SYNC_FL			0x00000008 /* Synchronous updates */
-#define EXT4_IMMUTABLE_FL		0x00000010 /* Immutable file */
-#define EXT4_APPEND_FL			0x00000020 /* writes to file may only append */
-#define EXT4_NODUMP_FL			0x00000040 /* do not dump file */
-#define EXT4_NOATIME_FL			0x00000080 /* do not update atime */
+#define	EXT4_SECRM_FL			FS_SECRM_FL        /* Secure deletion */
+#define	EXT4_UNRM_FL			FS_UNRM_FL         /* Undelete */
+#define	EXT4_COMPR_FL			FS_COMPR_FL        /* Compress file */
+#define EXT4_SYNC_FL			FS_SYNC_FL         /* Synchronous updates */
+#define EXT4_IMMUTABLE_FL		FS_IMMUTABLE_FL    /* Immutable file */
+#define EXT4_APPEND_FL			FS_APPEND_FL       /* writes to file may only append */
+#define EXT4_NODUMP_FL			FS_NODUMP_FL       /* do not dump file */
+#define EXT4_NOATIME_FL			FS_NOATIME_FL      /* do not update atime */
 /* Reserved for compression usage... */
-#define EXT4_DIRTY_FL			0x00000100
-#define EXT4_COMPRBLK_FL		0x00000200 /* One or more compressed clusters */
-#define EXT4_NOCOMPR_FL			0x00000400 /* Don't compress */
+#define EXT4_DIRTY_FL			FS_DIRTY_FL
+#define EXT4_COMPRBLK_FL		FS_COMPRBLK_FL     /* One or more compressed clusters */
+#define EXT4_NOCOMPR_FL			FS_NOCOMP_FL       /* Don't compress */
 	/* nb: was previously EXT2_ECOMPR_FL */
-#define EXT4_ENCRYPT_FL			0x00000800 /* encrypted file */
+#define EXT4_ENCRYPT_FL			0x00000800         /* encrypted file */
 /* End compression flags --- maybe not all used */
-#define EXT4_INDEX_FL			0x00001000 /* hash-indexed directory */
-#define EXT4_IMAGIC_FL			0x00002000 /* AFS directory */
-#define EXT4_JOURNAL_DATA_FL		0x00004000 /* file data should be journaled */
-#define EXT4_NOTAIL_FL			0x00008000 /* file tail should not be merged */
-#define EXT4_DIRSYNC_FL			0x00010000 /* dirsync behaviour (directories only) */
-#define EXT4_TOPDIR_FL			0x00020000 /* Top of directory hierarchies*/
-#define EXT4_HUGE_FILE_FL               0x00040000 /* Set to each huge file */
-#define EXT4_EXTENTS_FL			0x00080000 /* Inode uses extents */
-#define EXT4_EA_INODE_FL	        0x00200000 /* Inode used for large EA */
-#define EXT4_EOFBLOCKS_FL		0x00400000 /* Blocks allocated beyond EOF */
-#define EXT4_INLINE_DATA_FL		0x10000000 /* Inode has inline data. */
-#define EXT4_PROJINHERIT_FL		0x20000000 /* Create with parents projid */
-#define EXT4_RESERVED_FL		0x80000000 /* reserved for ext4 lib */
+#define EXT4_INDEX_FL			FS_INDEX_FL        /* hash-indexed directory */
+#define EXT4_IMAGIC_FL			FS_IMAGIC_FL       /* AFS directory */
+#define EXT4_JOURNAL_DATA_FL		FS_JOURNAL_DATA_FL /* file data should be journaled */
+#define EXT4_NOTAIL_FL			FS_NOTAIL_FL       /* file tail should not be merged */
+#define EXT4_DIRSYNC_FL			FS_DIRSYNC_FL      /* dirsync behaviour (directories only) */
+#define EXT4_TOPDIR_FL			FS_TOPDIR_FL       /* Top of directory hierarchies*/
+#define EXT4_HUGE_FILE_FL               0x00040000         /* Set to each huge file */
+#define EXT4_EXTENTS_FL			FS_EXTENT_FL       /* Inode uses extents */
+#define EXT4_EA_INODE_FL	        0x00200000         /* Inode used for large EA */
+#define EXT4_EOFBLOCKS_FL		0x00400000         /* Blocks allocated beyond EOF */
+#define EXT4_INLINE_DATA_FL		0x10000000         /* Inode has inline data. */
+#define EXT4_PROJINHERIT_FL		FS_PROJINHERIT_FL  /* Create with parents projid */
+#define EXT4_RESERVED_FL		FS_RESERVED_FL     /* reserved for ext4 lib */
 
 #define EXT4_FL_USER_VISIBLE		0x304BDFFF /* User visible flags */
 #define EXT4_FL_USER_MODIFIABLE		0x204380FF /* User modifiable flags */
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [v14 0/4] ext4: add project quota support
       [not found] ` <1429728997-21464-1-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
  2015-04-22 18:56   ` [v14 1/4] ext4: adds project ID support Li Xi
  2015-04-22 18:56   ` [v14 4/4] ext4: cleanup inode flag definitions Li Xi
@ 2015-04-22 19:45   ` Andreas Dilger
  2 siblings, 0 replies; 16+ messages in thread
From: Andreas Dilger @ 2015-04-22 19:45 UTC (permalink / raw)
  To: Li Xi
  Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
	linux-ext4-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, tytso-3s7WtUTddSA,
	jack-AlSwsSmVLrQ, viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn,
	hch-wEGCiKHe2LqWVfeAwA7xHQ, dmonakhov-GEFAQzZX7r8dnm+yROfE0A

On Apr 22, 2015, at 12:56 PM, Li Xi <pkuelelixi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 
> The following patches propose an implementation of project quota
> support for ext4. A project is an aggregate of unrelated inodes
> which might scatter in different directories. Inodes that belong
> to the same project possess an identical identification i.e.
> 'project ID', just like every inode has its user/group
> identification. The following patches add project quota as
> supplement to the former uer/group quota types.
> 
> The semantics of ext4 project quota is consistent with XFS. Each
> directory can have EXT4_INODE_PROJINHERIT flag set. When the
> EXT4_INODE_PROJINHERIT flag of a parent directory is not set, a
> newly created inode under that directory will have a default project
> ID (i.e. 0). And its EXT4_INODE_PROJINHERIT flag is not set either.
> When this flag is set on a directory, following rules will be kept:
> 
> 1) The newly created inode under that directory will inherit both
> the EXT4_INODE_PROJINHERIT flag and the project ID from its parent
> directory.
> 
> 2) Hard-linking a inode with different project ID into that directory
> will fail with errno EXDEV.
> 
> 3) Renaming a inode with different project ID into that directory
> will fail with errno EXDEV. However, 'mv' command will detect this
> failure and copy the renamed inode to a new inode in the directory.
> Thus, this new inode will inherit both the project ID and
> EXT4_INODE_PROJINHERIT flag.
> 
> 4) If the project quota of that ID is being enforced, statfs() on
> that directory will take the quotas as another upper limits along
> with the capacity of the file system, i.e. the total block/inode
> number will be the minimum of the quota limits and file system
> capacity.

Thanks for this last update.  You can add my Reviewed-by to the remaining
patches in the series.

Cheers, Andreas

> Changelog:
> * v14 <- v13:
> - Cleanup ioctl of setting project ID;
> - Do not check project quota inode number specially;
> - Check isize when extract project ID from disk;
> - Rebase to latest kernel (4.0.0)
> * v13 <- v12:
> - Update inode size check of project ID.
> * v12 <- v11:
> - Relax the permission check when setting project ID.
> * v11 <- v10:
> - Remove project quota mount option;
> - Fix permission check when setting project ID.
> * v10 <- v9:
> - Remove non-journaled project quota interface;
> - Only allow admin to read project quota info;
> - Cleanup FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface.
> * v9 <- v8:
> - Remove non-journaled project quota;
> - Rebase to newest dev branch of ext4 repository (3.19.0-rc3).
> * v8 <- v7:
> - Rebase to newest dev branch of ext4 repository (3.18.0_rc3).
> * v7 <- v6:
> - Map ext4 inode flags to xflags of struct fsxattr;
> - Add patch to cleanup ext4 inode flag definitions.
> * v6 <- v5:
> - Add project ID check for cross rename;
> - Remove patch of EXT4_IOC_GETPROJECT/EXT4_IOC_SETPROJECT ioctl
> * v5 <- v4:
> - Check project feature when set/get project ID;
> - Do not check project feature for project quota;
> - Add support of FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR.
> * v4 <- v3:
> - Do not check project feature when set/get project ID;
> - Use EXT4_MAXQUOTAS instead of MAXQUOTAS in ext4 patches;
> - Remove unnecessary change of fs/quota/dquot.c;
> - Remove CONFIG_QUOTA_PROJECT.
> * v3 <- v2:
> - Add EXT4_INODE_PROJINHERIT semantics.
> * v2 <- v1:
> - Add ioctl interface for setting/getting project;
> - Add EXT4_FEATURE_RO_COMPAT_PROJECT;
> - Add get_projid() method in struct dquot_operations;
> - Add error check of ext4_inode_projid_set/get().
> 
> v13: http://www.spinics.net/lists/linux-fsdevel/msg85205.html
> v12: http://www.spinics.net/lists/linux-fsdevel/msg84905.html
> v11: http://www.spinics.net/lists/linux-ext4/msg47450.html
> v10: http://www.spinics.net/lists/linux-ext4/msg47413.html
> v9: http://www.spinics.net/lists/linux-ext4/msg47326.html
> v8: http://www.spinics.net/lists/linux-ext4/msg46545.html
> v7: http://www.spinics.net/lists/linux-fsdevel/msg80404.html
> v6: http://www.spinics.net/lists/linux-fsdevel/msg80022.html
> v5: http://www.spinics.net/lists/linux-api/msg04840.html
> v4: http://lwn.net/Articles/612972/
> v3: http://www.spinics.net/lists/linux-ext4/msg45184.html
> v2: http://www.spinics.net/lists/linux-ext4/msg44695.html
> v1: http://article.gmane.org/gmane.comp.file-systems.ext4/45153
> 
> Any comments or feedbacks are appreciated.
> 
> Regards,
>                                         - Li Xi
> 
> Li Xi (4):
>  ext4: adds project ID support
>  ext4: adds project quota support
>  ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
>  ext4: cleanup inode flag definitions
> 
> fs/ext4/ext4.h          |   85 +++++++----
> fs/ext4/ialloc.c        |    5 +
> fs/ext4/inode.c         |   28 ++++
> fs/ext4/ioctl.c         |  367 ++++++++++++++++++++++++++++++++++++-----------
> fs/ext4/namei.c         |   20 +++
> fs/ext4/super.c         |   57 +++++++-
> fs/xfs/libxfs/xfs_fs.h  |   47 +++----
> include/uapi/linux/fs.h |   33 +++++
> 8 files changed, 489 insertions(+), 153 deletions(-)
> 


Cheers, Andreas

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [v14 3/4] ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
  2015-04-22 18:56 ` [v14 3/4] ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support Li Xi
@ 2015-04-24 16:40   ` Jan Kara
       [not found]   ` <1429728997-21464-4-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
  1 sibling, 0 replies; 16+ messages in thread
From: Jan Kara @ 2015-04-24 16:40 UTC (permalink / raw)
  To: Li Xi
  Cc: linux-fsdevel, linux-ext4, linux-api, tytso, adilger, jack, viro,
	hch, dmonakhov

On Thu 23-04-15 03:56:36, Li Xi wrote:
> This patch adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR ioctl interface
> support for ext4. The interface is kept consistent with
> XFS_IOC_FSGETXATTR/XFS_IOC_FSGETXATTR.
> 
> Signed-off-by: Li Xi <lixi@ddn.com>
  The patch looks good to me. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/ext4.h          |    9 ++
>  fs/ext4/ioctl.c         |  367 ++++++++++++++++++++++++++++++++++++-----------
>  fs/xfs/libxfs/xfs_fs.h  |   47 +++----
>  include/uapi/linux/fs.h |   32 ++++
>  4 files changed, 338 insertions(+), 117 deletions(-)
> 
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 0729a42..9995c53 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -384,6 +384,13 @@ struct flex_groups {
>  #define EXT4_FL_USER_VISIBLE		0x304BDFFF /* User visible flags */
>  #define EXT4_FL_USER_MODIFIABLE		0x204380FF /* User modifiable flags */
>  
> +#define EXT4_FL_XFLAG_VISIBLE		(EXT4_SYNC_FL | \
> +					 EXT4_IMMUTABLE_FL | \
> +					 EXT4_APPEND_FL | \
> +					 EXT4_NODUMP_FL | \
> +					 EXT4_NOATIME_FL | \
> +					 EXT4_PROJINHERIT_FL)
> +
>  /* Flags that should be inherited by new inodes from their parent. */
>  #define EXT4_FL_INHERITED (EXT4_SECRM_FL | EXT4_UNRM_FL | EXT4_COMPR_FL |\
>  			   EXT4_SYNC_FL | EXT4_NODUMP_FL | EXT4_NOATIME_FL |\
> @@ -618,6 +625,8 @@ enum {
>  #define EXT4_IOC_SET_ENCRYPTION_POLICY	_IOR('f', 19, struct ext4_encryption_policy)
>  #define EXT4_IOC_GET_ENCRYPTION_PWSALT	_IOW('f', 20, __u8[16])
>  #define EXT4_IOC_GET_ENCRYPTION_POLICY	_IOW('f', 21, struct ext4_encryption_policy)
> +#define EXT4_IOC_FSGETXATTR		FS_IOC_FSGETXATTR
> +#define EXT4_IOC_FSSETXATTR		FS_IOC_FSSETXATTR
>  
>  #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
>  /*
> diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
> index 2cb9e17..100b774 100644
> --- a/fs/ext4/ioctl.c
> +++ b/fs/ext4/ioctl.c
> @@ -14,6 +14,7 @@
>  #include <linux/mount.h>
>  #include <linux/file.h>
>  #include <linux/random.h>
> +#include <linux/quotaops.h>
>  #include <asm/uaccess.h>
>  #include "ext4_jbd2.h"
>  #include "ext4.h"
> @@ -206,6 +207,229 @@ static int uuid_is_zero(__u8 u[16])
>  	return 1;
>  }
>  
> +static int ext4_ioctl_setflags(struct inode *inode,
> +			       unsigned int flags)
> +{
> +	struct ext4_inode_info *ei = EXT4_I(inode);
> +	handle_t *handle = NULL;
> +	int err = EPERM, migrate = 0;
> +	struct ext4_iloc iloc;
> +	unsigned int oldflags, mask, i;
> +	unsigned int jflag;
> +
> +	/* Is it quota file? Do not allow user to mess with it */
> +	if (IS_NOQUOTA(inode))
> +		goto flags_out;
> +
> +	oldflags = ei->i_flags;
> +
> +	/* The JOURNAL_DATA flag is modifiable only by root */
> +	jflag = flags & EXT4_JOURNAL_DATA_FL;
> +
> +	/*
> +	 * The IMMUTABLE and APPEND_ONLY flags can only be changed by
> +	 * the relevant capability.
> +	 *
> +	 * This test looks nicer. Thanks to Pauline Middelink
> +	 */
> +	if ((flags ^ oldflags) & (EXT4_APPEND_FL | EXT4_IMMUTABLE_FL)) {
> +		if (!capable(CAP_LINUX_IMMUTABLE))
> +			goto flags_out;
> +	}
> +
> +	/*
> +	 * The JOURNAL_DATA flag can only be changed by
> +	 * the relevant capability.
> +	 */
> +	if ((jflag ^ oldflags) & (EXT4_JOURNAL_DATA_FL)) {
> +		if (!capable(CAP_SYS_RESOURCE))
> +			goto flags_out;
> +	}
> +	if ((flags ^ oldflags) & EXT4_EXTENTS_FL)
> +		migrate = 1;
> +
> +	if (flags & EXT4_EOFBLOCKS_FL) {
> +		/* we don't support adding EOFBLOCKS flag */
> +		if (!(oldflags & EXT4_EOFBLOCKS_FL)) {
> +			err = -EOPNOTSUPP;
> +			goto flags_out;
> +		}
> +	} else if (oldflags & EXT4_EOFBLOCKS_FL)
> +		ext4_truncate(inode);
> +
> +	handle = ext4_journal_start(inode, EXT4_HT_INODE, 1);
> +	if (IS_ERR(handle)) {
> +		err = PTR_ERR(handle);
> +		goto flags_out;
> +	}
> +	if (IS_SYNC(inode))
> +		ext4_handle_sync(handle);
> +	err = ext4_reserve_inode_write(handle, inode, &iloc);
> +	if (err)
> +		goto flags_err;
> +
> +	for (i = 0, mask = 1; i < 32; i++, mask <<= 1) {
> +		if (!(mask & EXT4_FL_USER_MODIFIABLE))
> +			continue;
> +		if (mask & flags)
> +			ext4_set_inode_flag(inode, i);
> +		else
> +			ext4_clear_inode_flag(inode, i);
> +	}
> +
> +	ext4_set_inode_flags(inode);
> +	inode->i_ctime = ext4_current_time(inode);
> +
> +	err = ext4_mark_iloc_dirty(handle, inode, &iloc);
> +flags_err:
> +	ext4_journal_stop(handle);
> +	if (err)
> +		goto flags_out;
> +
> +	if ((jflag ^ oldflags) & (EXT4_JOURNAL_DATA_FL))
> +		err = ext4_change_inode_journal_flag(inode, jflag);
> +	if (err)
> +		goto flags_out;
> +	if (migrate) {
> +		if (flags & EXT4_EXTENTS_FL)
> +			err = ext4_ext_migrate(inode);
> +		else
> +			err = ext4_ind_migrate(inode);
> +	}
> +
> +flags_out:
> +	return err;
> +}
> +
> +static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
> +{
> +	struct inode *inode = file_inode(filp);
> +	struct super_block *sb = inode->i_sb;
> +	struct ext4_inode_info *ei = EXT4_I(inode);
> +	int err, rc;
> +	handle_t *handle;
> +	kprojid_t kprojid;
> +	struct ext4_iloc iloc;
> +	struct ext4_inode *raw_inode;
> +	struct dquot *transfer_to[EXT4_MAXQUOTAS] = { };
> +
> +	if (!EXT4_HAS_RO_COMPAT_FEATURE(sb,
> +			EXT4_FEATURE_RO_COMPAT_PROJECT)) {
> +		BUG_ON(__kprojid_val(EXT4_I(inode)->i_projid)
> +		       != EXT4_DEF_PROJID);
> +		if (projid != EXT4_DEF_PROJID)
> +			return -EOPNOTSUPP;
> +		else
> +			return 0;
> +	}
> +
> +	if (EXT4_INODE_SIZE(sb) <= EXT4_GOOD_OLD_INODE_SIZE)
> +	    	return -EOPNOTSUPP;
> +
> +	kprojid = make_kprojid(&init_user_ns, (projid_t)projid);
> +
> +	if (projid_eq(kprojid, EXT4_I(inode)->i_projid))
> +		return 0;
> +
> +	err = mnt_want_write_file(filp);
> +	if (err)
> +		return err;
> +
> +	err = -EPERM;
> +	mutex_lock(&inode->i_mutex);
> +	/* Is it quota file? Do not allow user to mess with it */
> +	if (IS_NOQUOTA(inode))
> +		goto out_unlock;
> +
> +	err = ext4_get_inode_loc(inode, &iloc);
> +	if (err)
> +		goto out_unlock;
> +
> +	raw_inode = ext4_raw_inode(&iloc);
> +	if (!EXT4_FITS_IN_INODE(raw_inode, ei, i_projid)) {
> +	    	err = -EOVERFLOW;
> +	    	brelse(iloc.bh);
> +	    	goto out_unlock;
> +	}
> +	brelse(iloc.bh);
> +
> +	dquot_initialize(inode);
> +
> +	handle = ext4_journal_start(inode, EXT4_HT_QUOTA,
> +		EXT4_QUOTA_INIT_BLOCKS(sb) +
> +		EXT4_QUOTA_DEL_BLOCKS(sb) + 3);
> +	if (IS_ERR(handle)) {
> +		err = PTR_ERR(handle);
> +		goto out_unlock;
> +	}
> +
> +	err = ext4_reserve_inode_write(handle, inode, &iloc);
> +	if (err)
> +		goto out_stop;
> +
> +	transfer_to[PRJQUOTA] = dqget(sb, make_kqid_projid(kprojid));
> +	if (transfer_to[PRJQUOTA]) {
> +		err = __dquot_transfer(inode, transfer_to);
> +		dqput(transfer_to[PRJQUOTA]);
> +		if (err)
> +			goto out_dirty;
> +	}
> +
> +	EXT4_I(inode)->i_projid = kprojid;
> +	inode->i_ctime = ext4_current_time(inode);
> +out_dirty:
> +	rc = ext4_mark_iloc_dirty(handle, inode, &iloc);
> +	if (!err)
> +		err = rc;
> +out_stop:
> +	ext4_journal_stop(handle);
> +out_unlock:
> +	mutex_unlock(&inode->i_mutex);
> +	mnt_drop_write_file(filp);
> +	return err;
> +}
> +
> +/* Transfer internal flags to xflags */
> +static inline __u32 ext4_iflags_to_xflags(unsigned long iflags)
> +{
> +	__u32 xflags = 0;
> +
> +	if (iflags & EXT4_SYNC_FL)
> +		xflags |= FS_XFLAG_SYNC;
> +	if (iflags & EXT4_IMMUTABLE_FL)
> +		xflags |= FS_XFLAG_IMMUTABLE;
> +	if (iflags & EXT4_APPEND_FL)
> +		xflags |= FS_XFLAG_APPEND;
> +	if (iflags & EXT4_NODUMP_FL)
> +		xflags |= FS_XFLAG_NODUMP;
> +	if (iflags & EXT4_NOATIME_FL)
> +		xflags |= FS_XFLAG_NOATIME;
> +	if (iflags & EXT4_PROJINHERIT_FL)
> +		xflags |= FS_XFLAG_PROJINHERIT;
> +	return xflags;
> +}
> +
> +/* Transfer xflags flags to internal */
> +static inline unsigned long ext4_xflags_to_iflags(__u32 xflags)
> +{
> +	unsigned long iflags = 0;
> +
> +	if (xflags & FS_XFLAG_SYNC)
> +		iflags |= EXT4_SYNC_FL;
> +	if (xflags & FS_XFLAG_IMMUTABLE)
> +		iflags |= EXT4_IMMUTABLE_FL;
> +	if (xflags & FS_XFLAG_APPEND)
> +		iflags |= EXT4_APPEND_FL;
> +	if (xflags & FS_XFLAG_NODUMP)
> +		iflags |= EXT4_NODUMP_FL;
> +	if (xflags & FS_XFLAG_NOATIME)
> +		iflags |= EXT4_NOATIME_FL;
> +	if (xflags & FS_XFLAG_PROJINHERIT)
> +		iflags |= EXT4_PROJINHERIT_FL;
> +
> +	return iflags;
> +}
> +
>  long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
>  {
>  	struct inode *inode = file_inode(filp);
> @@ -221,11 +445,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
>  		flags = ei->i_flags & EXT4_FL_USER_VISIBLE;
>  		return put_user(flags, (int __user *) arg);
>  	case EXT4_IOC_SETFLAGS: {
> -		handle_t *handle = NULL;
> -		int err, migrate = 0;
> -		struct ext4_iloc iloc;
> -		unsigned int oldflags, mask, i;
> -		unsigned int jflag;
> +		int err;
>  
>  		if (!inode_owner_or_capable(inode))
>  			return -EACCES;
> @@ -239,89 +459,8 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
>  
>  		flags = ext4_mask_flags(inode->i_mode, flags);
>  
> -		err = -EPERM;
>  		mutex_lock(&inode->i_mutex);
> -		/* Is it quota file? Do not allow user to mess with it */
> -		if (IS_NOQUOTA(inode))
> -			goto flags_out;
> -
> -		oldflags = ei->i_flags;
> -
> -		/* The JOURNAL_DATA flag is modifiable only by root */
> -		jflag = flags & EXT4_JOURNAL_DATA_FL;
> -
> -		/*
> -		 * The IMMUTABLE and APPEND_ONLY flags can only be changed by
> -		 * the relevant capability.
> -		 *
> -		 * This test looks nicer. Thanks to Pauline Middelink
> -		 */
> -		if ((flags ^ oldflags) & (EXT4_APPEND_FL | EXT4_IMMUTABLE_FL)) {
> -			if (!capable(CAP_LINUX_IMMUTABLE))
> -				goto flags_out;
> -		}
> -
> -		/*
> -		 * The JOURNAL_DATA flag can only be changed by
> -		 * the relevant capability.
> -		 */
> -		if ((jflag ^ oldflags) & (EXT4_JOURNAL_DATA_FL)) {
> -			if (!capable(CAP_SYS_RESOURCE))
> -				goto flags_out;
> -		}
> -		if ((flags ^ oldflags) & EXT4_EXTENTS_FL)
> -			migrate = 1;
> -
> -		if (flags & EXT4_EOFBLOCKS_FL) {
> -			/* we don't support adding EOFBLOCKS flag */
> -			if (!(oldflags & EXT4_EOFBLOCKS_FL)) {
> -				err = -EOPNOTSUPP;
> -				goto flags_out;
> -			}
> -		} else if (oldflags & EXT4_EOFBLOCKS_FL)
> -			ext4_truncate(inode);
> -
> -		handle = ext4_journal_start(inode, EXT4_HT_INODE, 1);
> -		if (IS_ERR(handle)) {
> -			err = PTR_ERR(handle);
> -			goto flags_out;
> -		}
> -		if (IS_SYNC(inode))
> -			ext4_handle_sync(handle);
> -		err = ext4_reserve_inode_write(handle, inode, &iloc);
> -		if (err)
> -			goto flags_err;
> -
> -		for (i = 0, mask = 1; i < 32; i++, mask <<= 1) {
> -			if (!(mask & EXT4_FL_USER_MODIFIABLE))
> -				continue;
> -			if (mask & flags)
> -				ext4_set_inode_flag(inode, i);
> -			else
> -				ext4_clear_inode_flag(inode, i);
> -		}
> -
> -		ext4_set_inode_flags(inode);
> -		inode->i_ctime = ext4_current_time(inode);
> -
> -		err = ext4_mark_iloc_dirty(handle, inode, &iloc);
> -flags_err:
> -		ext4_journal_stop(handle);
> -		if (err)
> -			goto flags_out;
> -
> -		if ((jflag ^ oldflags) & (EXT4_JOURNAL_DATA_FL))
> -			err = ext4_change_inode_journal_flag(inode, jflag);
> -		if (err)
> -			goto flags_out;
> -		if (migrate) {
> -			if (flags & EXT4_EXTENTS_FL)
> -				err = ext4_ext_migrate(inode);
> -			else
> -				err = ext4_ind_migrate(inode);
> -		}
> -
> -flags_out:
> +		err = ext4_ioctl_setflags(inode, flags);
>  		mutex_unlock(&inode->i_mutex);
>  		mnt_drop_write_file(filp);
>  		return err;
> @@ -697,6 +836,60 @@ encryption_policy_out:
>  		return -EOPNOTSUPP;
>  #endif
>  	}
> +	case EXT4_IOC_FSGETXATTR:
> +	{
> +		struct fsxattr fa;
> +
> +		memset(&fa, 0, sizeof(struct fsxattr));
> +		ext4_get_inode_flags(ei);
> +		fa.fsx_xflags = ext4_iflags_to_xflags(ei->i_flags & EXT4_FL_USER_VISIBLE);
> +
> +		if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb,
> +				EXT4_FEATURE_RO_COMPAT_PROJECT)) {
> +			fa.fsx_projid = (__u32)from_kprojid(&init_user_ns,
> +				EXT4_I(inode)->i_projid);
> +		}
> +
> +		if (copy_to_user((struct fsxattr __user *)arg,
> +				 &fa, sizeof(fa)))
> +			return -EFAULT;
> +		return 0;
> +	}
> +	case EXT4_IOC_FSSETXATTR:
> +	{
> +		struct fsxattr fa;
> +		int err;
> +
> +		if (copy_from_user(&fa, (struct fsxattr __user *)arg,
> +				   sizeof(fa)))
> +			return -EFAULT;
> +
> +		/* Make sure caller has proper permission */
> +		if (!inode_owner_or_capable(inode))
> +			return -EACCES;
> +
> +		err = mnt_want_write_file(filp);
> +		if (err)
> +			return err;
> +
> +		flags = ext4_xflags_to_iflags(fa.fsx_xflags);
> +		flags = ext4_mask_flags(inode->i_mode, flags);
> +
> +		mutex_lock(&inode->i_mutex);
> +		flags = (ei->i_flags & ~EXT4_FL_XFLAG_VISIBLE) |
> +			 (flags & EXT4_FL_XFLAG_VISIBLE);
> +		err = ext4_ioctl_setflags(inode, flags);
> +		mutex_unlock(&inode->i_mutex);
> +		mnt_drop_write_file(filp);
> +		if (err)
> +			return err;
> +
> +		err = ext4_ioctl_setproject(filp, fa.fsx_projid);
> +		if (err)
> +			return err;
> +
> +		return 0;
> +	}
>  	default:
>  		return -ENOTTY;
>  	}
> diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h
> index 18dc721..64c7ae6 100644
> --- a/fs/xfs/libxfs/xfs_fs.h
> +++ b/fs/xfs/libxfs/xfs_fs.h
> @@ -36,38 +36,25 @@ struct dioattr {
>  #endif
>  
>  /*
> - * Structure for XFS_IOC_FSGETXATTR[A] and XFS_IOC_FSSETXATTR.
> - */
> -#ifndef HAVE_FSXATTR
> -struct fsxattr {
> -	__u32		fsx_xflags;	/* xflags field value (get/set) */
> -	__u32		fsx_extsize;	/* extsize field value (get/set)*/
> -	__u32		fsx_nextents;	/* nextents field value (get)	*/
> -	__u32		fsx_projid;	/* project identifier (get/set) */
> -	unsigned char	fsx_pad[12];
> -};
> -#endif
> -
> -/*
>   * Flags for the bs_xflags/fsx_xflags field
>   * There should be a one-to-one correspondence between these flags and the
>   * XFS_DIFLAG_s.
>   */
> -#define XFS_XFLAG_REALTIME	0x00000001	/* data in realtime volume */
> -#define XFS_XFLAG_PREALLOC	0x00000002	/* preallocated file extents */
> -#define XFS_XFLAG_IMMUTABLE	0x00000008	/* file cannot be modified */
> -#define XFS_XFLAG_APPEND	0x00000010	/* all writes append */
> -#define XFS_XFLAG_SYNC		0x00000020	/* all writes synchronous */
> -#define XFS_XFLAG_NOATIME	0x00000040	/* do not update access time */
> -#define XFS_XFLAG_NODUMP	0x00000080	/* do not include in backups */
> -#define XFS_XFLAG_RTINHERIT	0x00000100	/* create with rt bit set */
> -#define XFS_XFLAG_PROJINHERIT	0x00000200	/* create with parents projid */
> -#define XFS_XFLAG_NOSYMLINKS	0x00000400	/* disallow symlink creation */
> -#define XFS_XFLAG_EXTSIZE	0x00000800	/* extent size allocator hint */
> -#define XFS_XFLAG_EXTSZINHERIT	0x00001000	/* inherit inode extent size */
> -#define XFS_XFLAG_NODEFRAG	0x00002000  	/* do not defragment */
> -#define XFS_XFLAG_FILESTREAM	0x00004000	/* use filestream allocator */
> -#define XFS_XFLAG_HASATTR	0x80000000	/* no DIFLAG for this	*/
> +#define XFS_XFLAG_REALTIME	FS_XFLAG_REALTIME	/* data in realtime volume */
> +#define XFS_XFLAG_PREALLOC	FS_XFLAG_PREALLOC	/* preallocated file extents */
> +#define XFS_XFLAG_IMMUTABLE	FS_XFLAG_IMMUTABLE	/* file cannot be modified */
> +#define XFS_XFLAG_APPEND	FS_XFLAG_APPEND		/* all writes append */
> +#define XFS_XFLAG_SYNC		FS_XFLAG_SYNC		/* all writes synchronous */
> +#define XFS_XFLAG_NOATIME	FS_XFLAG_NOATIME	/* do not update access time */
> +#define XFS_XFLAG_NODUMP	FS_XFLAG_NODUMP		/* do not include in backups */
> +#define XFS_XFLAG_RTINHERIT	FS_XFLAG_RTINHERIT	/* create with rt bit set */
> +#define XFS_XFLAG_PROJINHERIT	FS_XFLAG_PROJINHERIT	/* create with parents projid */
> +#define XFS_XFLAG_NOSYMLINKS	FS_XFLAG_NOSYMLINKS	/* disallow symlink creation */
> +#define XFS_XFLAG_EXTSIZE	FS_XFLAG_EXTSIZE	/* extent size allocator hint */
> +#define XFS_XFLAG_EXTSZINHERIT	FS_XFLAG_EXTSZINHERIT	/* inherit inode extent size */
> +#define XFS_XFLAG_NODEFRAG	FS_XFLAG_NODEFRAG  	/* do not defragment */
> +#define XFS_XFLAG_FILESTREAM	FS_XFLAG_FILESTREAM	/* use filestream allocator */
> +#define XFS_XFLAG_HASATTR	FS_XFLAG_HASATTR	/* no DIFLAG for this	*/
>  
>  /*
>   * Structure for XFS_IOC_GETBMAP.
> @@ -503,8 +490,8 @@ typedef struct xfs_swapext
>  #define XFS_IOC_ALLOCSP		_IOW ('X', 10, struct xfs_flock64)
>  #define XFS_IOC_FREESP		_IOW ('X', 11, struct xfs_flock64)
>  #define XFS_IOC_DIOINFO		_IOR ('X', 30, struct dioattr)
> -#define XFS_IOC_FSGETXATTR	_IOR ('X', 31, struct fsxattr)
> -#define XFS_IOC_FSSETXATTR	_IOW ('X', 32, struct fsxattr)
> +#define XFS_IOC_FSGETXATTR	FS_IOC_FSGETXATTR
> +#define XFS_IOC_FSSETXATTR	FS_IOC_FSSETXATTR
>  #define XFS_IOC_ALLOCSP64	_IOW ('X', 36, struct xfs_flock64)
>  #define XFS_IOC_FREESP64	_IOW ('X', 37, struct xfs_flock64)
>  #define XFS_IOC_GETBMAP		_IOWR('X', 38, struct getbmap)
> diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
> index f15d980..627f58e 100644
> --- a/include/uapi/linux/fs.h
> +++ b/include/uapi/linux/fs.h
> @@ -58,6 +58,36 @@ struct inodes_stat_t {
>  	long dummy[5];		/* padding for sysctl ABI compatibility */
>  };
>  
> +/*
> + * Structure for FS_IOC_FSGETXATTR and FS_IOC_FSSETXATTR.
> + */
> +struct fsxattr {
> +	__u32		fsx_xflags;	/* xflags field value (get/set) */
> +	__u32		fsx_extsize;	/* extsize field value (get/set)*/
> +	__u32		fsx_nextents;	/* nextents field value (get)	*/
> +	__u32		fsx_projid;	/* project identifier (get/set) */
> +	unsigned char	fsx_pad[12];
> +};
> +
> +/*
> + * Flags for the fsx_xflags field
> + */
> +#define FS_XFLAG_REALTIME	0x00000001	/* data in realtime volume */
> +#define FS_XFLAG_PREALLOC	0x00000002	/* preallocated file extents */
> +#define FS_XFLAG_IMMUTABLE	0x00000008	/* file cannot be modified */
> +#define FS_XFLAG_APPEND		0x00000010	/* all writes append */
> +#define FS_XFLAG_SYNC		0x00000020	/* all writes synchronous */
> +#define FS_XFLAG_NOATIME	0x00000040	/* do not update access time */
> +#define FS_XFLAG_NODUMP		0x00000080	/* do not include in backups */
> +#define FS_XFLAG_RTINHERIT	0x00000100	/* create with rt bit set */
> +#define FS_XFLAG_PROJINHERIT	0x00000200	/* create with parents projid */
> +#define FS_XFLAG_NOSYMLINKS	0x00000400	/* disallow symlink creation */
> +#define FS_XFLAG_EXTSIZE	0x00000800	/* extent size allocator hint */
> +#define FS_XFLAG_EXTSZINHERIT	0x00001000	/* inherit inode extent size */
> +#define FS_XFLAG_NODEFRAG	0x00002000  	/* do not defragment */
> +#define FS_XFLAG_FILESTREAM	0x00004000	/* use filestream allocator */
> +#define FS_XFLAG_HASATTR	0x80000000	/* no DIFLAG for this */
> +
>  
>  #define NR_FILE  8192	/* this can well be larger on a larger system */
>  
> @@ -165,6 +195,8 @@ struct inodes_stat_t {
>  #define	FS_IOC_GETVERSION		_IOR('v', 1, long)
>  #define	FS_IOC_SETVERSION		_IOW('v', 2, long)
>  #define FS_IOC_FIEMAP			_IOWR('f', 11, struct fiemap)
> +#define FS_IOC_FSGETXATTR		_IOR('X', 31, struct fsxattr)
> +#define FS_IOC_FSSETXATTR		_IOW('X', 32, struct fsxattr)
>  #define FS_IOC32_GETFLAGS		_IOR('f', 1, int)
>  #define FS_IOC32_SETFLAGS		_IOW('f', 2, int)
>  #define FS_IOC32_GETVERSION		_IOR('v', 1, int)
> -- 
> 1.7.1
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [v14 3/4] ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
       [not found]   ` <1429728997-21464-4-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
@ 2015-04-26 23:20     ` Dave Chinner
  2015-04-28  2:01       ` Li Xi
  0 siblings, 1 reply; 16+ messages in thread
From: Dave Chinner @ 2015-04-26 23:20 UTC (permalink / raw)
  To: Li Xi
  Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
	linux-ext4-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, tytso-3s7WtUTddSA,
	adilger-m1MBpc4rdrD3fQ9qLvQP4Q, jack-AlSwsSmVLrQ,
	viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn,
	hch-wEGCiKHe2LqWVfeAwA7xHQ, dmonakhov-GEFAQzZX7r8dnm+yROfE0A

On Thu, Apr 23, 2015 at 03:56:36AM +0900, Li Xi wrote:
> This patch adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR ioctl interface
> support for ext4. The interface is kept consistent with
> XFS_IOC_FSGETXATTR/XFS_IOC_FSGETXATTR.

Have you run this patchthrough XFS testing to make sure everything
sill works?

Cheers,

Dave.
-- 
Dave Chinner
david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [v14 3/4] ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
  2015-04-26 23:20     ` Dave Chinner
@ 2015-04-28  2:01       ` Li Xi
       [not found]         ` <CAPTn0cAHOHP060cW8k0-HnyfKdVaUwAVOyLZU43AXtECK6_EaA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Li Xi @ 2015-04-28  2:01 UTC (permalink / raw)
  To: Dave Chinner
  Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Ext4 Developers List,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Theodore Ts'o,
	Andreas Dilger, Jan Kara, viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn,
	hch-wEGCiKHe2LqWVfeAwA7xHQ, Dmitry Monakhov

Hi Dave,

I ran xfstests on the kernel with this series of patches.
Unfortunately, 5 test suits failed. But I don't think they are caused
by this patch. Following is the result. Please let me know if there is
any problem about it.

Output of xfstests:

FSTYP         -- xfs (non-debug)
PLATFORM      -- Linux/x86_64 vm15 4.0.0+
MKFS_OPTIONS  -- -f -bsize=4096 /dev/sdb2
MOUNT_OPTIONS -- /dev/sdb2 /mnt/scratch

generic/001 3s ... 2s
generic/002 0s ... 0s
generic/003 10s ... 10s
generic/004     [not run] xfs_io flink support is missing
generic/005 0s ... 0s
generic/006 1s ... 0s
generic/007 0s ... 0s
generic/008     [not run] xfs_io fzero support is missing
generic/009     [not run] xfs_io fzero support is missing
generic/010 1s ... 0s
generic/011 1s ... 0s
generic/012     [not run] xfs_io fpunch support is missing
generic/013 92s ... 90s
generic/014 3s ... 3s
generic/015 1s ... 1s
generic/016     [not run] xfs_io fpunch support is missing
generic/017     [not run] xfs_io fiemap support is missing
generic/018     [not run] xfs_io fiemap support is missing
generic/020 38s ... 31s
generic/021     [not run] xfs_io fpunch support is missing
generic/022     [not run] xfs_io fpunch support is missing
generic/023 1s ... 0s
generic/024 1s ... 0s
generic/025 0s ... 0s
generic/026 0s ... 0s
generic/027 57s ... 57s
generic/028 5s ... 5s
generic/053 1s ... 2s
generic/062 1s ... 2s
generic/068 60s ... 61s
generic/069 4s ... 3s
generic/070 13s ... 14s
generic/074 164s ... 162s
generic/075 87s ... 86s
generic/076 1s ... 1s
generic/077     [not run] fsgqa user not defined.
generic/079 1s ... 1s
generic/083 36s ... 39s
generic/088 1s ... 0s
generic/089 4s ... 4s
generic/091 62s ... 62s
generic/093     [not run] not suitable for this OS: Linux
generic/097     [not run] not suitable for this OS: Linux
generic/099     [not run] not suitable for this OS: Linux
generic/100 12s ... 12s
generic/105 0s ... 0s
generic/112     [not run] fsx not built with AIO for this platform
generic/113     [not run] aio-stress not built for this platform
generic/117 15s ... 15s
generic/120 16s ... 16s
generic/123     [not run] fsgqa user not defined.
generic/124 4s ... 3s
generic/125     [not run] fsgqa user not defined.
generic/126 1s ... 0s
generic/127 1745s ... 1793s
generic/128     [not run] fsgqa user not defined.
generic/129 4s ... 4s
generic/130 13s ... 13s
generic/131 1s ... 1s
generic/132 40s ... 40s
generic/133 92s ... 94s
generic/135 1s ... 1s
generic/141 0s ... 1s
generic/169 1s ... 1s
generic/184 1s ... 0s
generic/192 40s ... 40s
generic/193     [not run] fsgqa user not defined.
generic/198     [not run] src/aio-dio-regress/aiodio_sparse2 not built
generic/204 6s ... 7s
generic/207     [not run] src/aio-dio-regress/aio-dio-extend-stat not built
generic/208     [not run]
src/aio-dio-regress/aio-dio-invalidate-failure not built
generic/209     [not run]
src/aio-dio-regress/aio-dio-invalidate-readahead not built
generic/210     [not run]
src/aio-dio-regress/aio-dio-subblock-eof-read not built
generic/211     [not run]
src/aio-dio-regress/aio-free-ring-with-bogus-nr-pages not built
generic/212     [not run]
src/aio-dio-regress/aio-io-setup-with-nonwritable-context-pointer not
built
generic/213 0s ... 0s
generic/214 0s ... 0s
generic/215 2s ... 3s
generic/219     [not run] fsgqa user not defined.
generic/221 1s ... 1s
generic/223 14s ... 14s
generic/224 59s ... 61s
generic/225 18s ... 17s
generic/226 18s ... 19s
generic/228 1s ... 0s
generic/230     [not run] fsgqa user not defined.
generic/231     [not run] fsgqa user not defined.
generic/232 55s ... 52s
generic/233     [not run] fsgqa user not defined.
generic/234 9s ... 9s
generic/235     [not run] fsgqa user not defined.
generic/236 2s ... 1s
generic/237 1s ... 0s
generic/239     [not run]
src/aio-dio-regress/aio-dio-hole-filling-race not built
generic/240     [not run] src/aio-dio-regress/aiodio_sparse2 not built
generic/241     [not run] dbench not found
generic/245 0s ... 0s
generic/246 0s ... 0s
generic/247 24s ... 24s
generic/248 0s ... 0s
generic/249 2s ... 1s
generic/255     [not run] xfs_io fpunch support is missing
generic/256     [not run] xfs_io fpunch support is missing
generic/257 0s ... 0s
generic/258 1s ... 0s
generic/260     [not run] FITRIM not supported on /dev/sdb2
generic/263 93s ... 96s
generic/269 113s ... 112s
generic/270     [not run] fsgqa user not defined.
generic/273 44s ... 40s
generic/274 72s ... 70s
generic/275 32s ... 33s
generic/277 2s ... 1s
generic/280 2s ... 2s
generic/285 0s ... 0s
generic/286 6s ... 5s
generic/288     [not run] FITRIM not supported on /dev/sdb2
generic/294 1s ... 0s
generic/299     [not run]  utility required, skipped this test
generic/300     [not run] xfs_io fpunch support is missing
generic/306     - output mismatch (see
/root/work/quota/ext4_inode_field/xfstests.git/results//generic/306.out.bad)
    --- tests/generic/306.out    2014-07-16 10:19:26.196995657 +0800
    +++ /root/work/quota/ext4_inode_field/xfstests.git/results//generic/306.out.bad
   2015-04-27 22:40:13.365445316 +0800
    @@ -2,11 +2,9 @@
     == try to create new file
     touch: cannot touch 'SCRATCH_MNT/this_should_fail': Read-only file system
     == pwrite to null device
    -wrote 512/512 bytes at offset 0
    -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
    +xfs_io: specified file ["/mnt/scratch/devnull"] is not on an XFS filesystem
     == pread from zero device
    ...
    (Run 'diff -u tests/generic/306.out
/root/work/quota/ext4_inode_field/xfstests.git/results//generic/306.out.bad'
 to see the entire diff)
generic/307 1s ... 2s
generic/308 0s ... 0s
generic/309 1s ... 1s
generic/310 62s ... 63s
generic/311 124s ... 129s
generic/312     [not run] this test requires $SCRATCH_DEV has 5368709120B space
generic/313 2s ... 2s
generic/314     [not run] fsgqa user not defined.
generic/315 0s ... 0s
generic/316     [not run] xfs_io fpunch support is missing
generic/317     [not run] fsgqa user not defined.
generic/318 1s ... 1s
generic/319 0s ... 1s
generic/320 65s ... 81s
generic/321 2s ... 2s
generic/322 1s ... 2s
shared/006 381s ... 386s
shared/032 8s ... 8s
shared/051 0s ... 1s
shared/272     [not run] not suitable for this filesystem type: xfs
shared/289     [not run] not suitable for this filesystem type: xfs
shared/298     [not run] xfs_io fiemap support is missing
xfs/001     [not run] mkfs.xfs doesn't have crc feature
xfs/002     [not run] mkfs.xfs doesn't have crc feature
xfs/003 0s ... 0s
xfs/004 1s ... 1s
xfs/005     [not run] mkfs.xfs doesn't have crc feature
xfs/006 3s ... 4s
xfs/007 1s ... 0s
xfs/008 0s ... 1s
xfs/009 0s ... 1s
xfs/010     [not run] mkfs.xfs doesn't have finobt feature
xfs/011 17s ... 17s
xfs/012 1s ... 1s
xfs/013     [not run] mkfs.xfs doesn't have finobt feature
xfs/014     [not run] fsgqa user not defined.
xfs/016 35s ... 37s
xfs/017 18s ... 18s
xfs/019 1s ... 1s
xfs/021 0s ... 1s
xfs/026     12s
xfs/027     12s
xfs/028     24s
xfs/029 0s ... 1s
xfs/030 9s ... 9s
xfs/031 7s ... 7s
xfs/033 6s ... 5s
xfs/034 1s ... 1s
xfs/035     [not run] No dump tape specified
xfs/040     [not run] Can't run srcdiff without KWORKAREA set
xfs/041 15s ... 17s
xfs/042 120s ... 123s
xfs/044     [not run] This test requires a valid $SCRATCH_LOGDEV
xfs/045 1s ... 1s
xfs/046     12s
xfs/047     23s
xfs/048 0s ... 0s
xfs/049 8s ... 8s
xfs/050 15s ... 15s
xfs/052 1s ... 2s
xfs/054 2s ... 3s
xfs/056     17s
xfs/057     [not run] Place holder for IRIX test 057
xfs/058     [not run] Place holder for IRIX test 058
xfs/059     [not run] xfsdump multi-stream support required
xfs/060     [not run] xfsdump multi-stream support required
xfs/061     12s
xfs/063     12s
xfs/064     77s
xfs/065     35s
xfs/066     25s
xfs/067 1s ... 1s
xfs/071 5s ... 5s
xfs/072 1s ... 1s
xfs/073 15s ... 22s
xfs/078 65s ... 66s
xfs/084 59s ... 59s
xfs/085 1s ... 1s
xfs/086 63s ... 65s
xfs/087 33s ... 34s
xfs/090     [not run] External volumes not in use, skipped this test
xfs/092 1s ... 1s
xfs/094     [not run] External volumes not in use, skipped this test
xfs/095     [not run] not suitable for this OS: Linux
xfs/096 3s ... 2s
xfs/103 1s ... 0s
xfs/104 96s ... 100s
xfs/108 6s ... 6s
xfs/109 29s ... 28s
xfs/110 12s ... 12s
xfs/116 1s ... 1s
xfs/118 1s ... 2s
xfs/119 4s ... 4s
xfs/121 6s ... 6s
xfs/122     [not run] Could not compile test program (see end of
/root/work/quota/ext4_inode_field/xfstests.git/results//xfs/122.full)
xfs/134 1s ... 1s
xfs/137 12s ... 12s
xfs/138 13s ... 14s
xfs/139 13s ... 13s
xfs/140 13s ... 13s
xfs/148     [not run] parallel repair binary xfs_prepair64 is not installed
xfs/149     [not run] parallel repair binary xfs_prepair is not installed
xfs/164 0s ... 0s
xfs/165 1s ... 0s
xfs/166 1s ... 0s
xfs/167     [not run] This test requires at least 10GB free on
/mnt/scratch to run
xfs/170 9s ... 10s
xfs/174 17s ... 19s
xfs/178 15s ... 15s
xfs/179 39s ... 41s
xfs/180     [not run] This test requires at least 10GB free on
/mnt/scratch to run
xfs/181 12s ... 13s
xfs/182 9s ... 9s
xfs/183 3s ... 3s
xfs/186 1s ... 2s
xfs/187 3s ... 2s
xfs/188 8s ... 7s
xfs/189     [not run] noattr2 mount option not supported on /dev/sdb2
xfs/190 1s ... 1s
xfs/191     [not run] no mkfs support for NFS v4 ACLs
xfs/194 1s ... 1s
xfs/195     [not run] fsgqa user not defined.
xfs/196 3s ... 4s
xfs/197     [not run] This test is only valid on 32 bit machines
xfs/199 1s ... 0s
xfs/200 1s ... 0s
xfs/201 2s ... 2s
xfs/202 1s ... 0s
xfs/203 0s ... 1s
xfs/205 2s ... 2s
xfs/206 31s ... 32s
xfs/216 10s ... 10s
xfs/217 128s ... 130s
xfs/220 1s ... 1s
xfs/222 1s ... 1s
xfs/227 493s ... 507s
xfs/229 134s ... [failed, exit status 23] - output mismatch (see
/root/work/quota/ext4_inode_field/xfstests.git/results//xfs/229.out.bad)
    --- tests/xfs/229.out    2014-07-16 10:19:26.215995657 +0800
    +++ /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/229.out.bad
   2015-04-27 23:25:48.709093428 +0800
    @@ -1,4 +1,31 @@
     QA output created by 229
     generating 10 files
    +Write did not return correct amount
    +Write did not return correct amount
    +Write did not return correct amount
    +Write did not return correct amount
     comparing files
    ...
    (Run 'diff -u tests/xfs/229.out
/root/work/quota/ext4_inode_field/xfstests.git/results//xfs/229.out.bad'
 to see the entire diff)
xfs/238 1s ... 1s
xfs/242     [not run] zero command not supported
xfs/244 2s ... 2s
xfs/250     [failed, exit status 1] - output mismatch (see
/root/work/quota/ext4_inode_field/xfstests.git/results//xfs/250.out.bad)
    --- tests/xfs/250.out    2014-07-16 10:19:26.215995657 +0800
    +++ /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/250.out.bad
   2015-04-27 23:26:15.137452337 +0800
    @@ -11,4 +11,4 @@
     *** preallocate large file
     *** unmount loop filesystem
     *** check loop filesystem
    -*** done
    +_check_xfs_filesystem: filesystem on /mnt/test/250.fs is
inconsistent (r) (see
/root/work/quota/ext4_inode_field/xfstests.git/results//xfs/250.full)
    ...
    (Run 'diff -u tests/xfs/250.out
/root/work/quota/ext4_inode_field/xfstests.git/results//xfs/250.out.bad'
 to see the entire diff)
xfs/252     [not run] xfs_io fpunch support is missing
xfs/253 2s ... 3s
xfs/259 33s ... 34s
xfs/261 1s ... 1s
xfs/262 1s ... 1s
xfs/266     [not run] requires xfsdump -D
xfs/278 1s ... 1s
xfs/279 8s ... 8s
xfs/281     [not run] xfsdump -K option required
xfs/282     [not run] xfsdump -K option required
xfs/283     [not run] xfsdump -K option required
xfs/287     2s
xfs/290     [not run] xfs_io zero support is missing
xfs/291 52s ... 54s
xfs/292 4s ... 4s
xfs/293 2s ... 2s
xfs/295 8s ... 7s
xfs/296     12s
xfs/297 306s ... 229s
xfs/298 6s ... 6s
xfs/299     [not run] mkfs.xfs doesn't have crc feature
xfs/300     [not run] SELinux not enabled
xfs/301     - output mismatch (see
/root/work/quota/ext4_inode_field/xfstests.git/results//xfs/301.out.bad)
    --- tests/xfs/301.out    2014-07-16 10:19:26.217995657 +0800
    +++ /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/301.out.bad
   2015-04-27 23:33:33.629182381 +0800
    @@ -29,18 +29,21 @@
     Attribute "attr4" had a 10 byte value for DUMP_DIR/sub/biggg:
     some_text4
     EAs on restore
    +getfattr: /mnt/scratch/restoredir/dumpdir: No such file or directory
    +getfattr: /mnt/scratch/restoredir/dumpdir: No such file or directory
     User names
    -Attribute "attr5" had a 8 byte value for DUMP_DIR/dir:
    ...
    (Run 'diff -u tests/xfs/301.out
/root/work/quota/ext4_inode_field/xfstests.git/results//xfs/301.out.bad'
 to see the entire diff)
xfs/302     [failed, exit status 1] - output mismatch (see
/root/work/quota/ext4_inode_field/xfstests.git/results//xfs/302.out.bad)
    --- tests/xfs/302.out    2014-07-16 10:19:26.217995657 +0800
    +++ /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/302.out.bad
   2015-04-27 23:33:46.102767709 +0800
    @@ -1,2 +1,4 @@
     QA output created by 302
     Silence is golden.
    +dump failed
    +(see /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/302.full
for details)
    ...
    (Run 'diff -u tests/xfs/302.out
/root/work/quota/ext4_inode_field/xfstests.git/results//xfs/302.out.bad'
 to see the entire diff)
xfs/303 0s ... 0s
xfs/304     [not run] mkfs.xfs doesn't have crc feature
xfs/305     [not run] mkfs.xfs doesn't have crc feature
xfs/306 76s ... 76s
Ran: generic/001 generic/002 generic/003 generic/005 generic/006
generic/007 generic/010 generic/011 generic/013 generic/014
generic/015 generic/020 generic/023 generic/024 generic/025
generic/026 generic/027 generic/028 generic/053 generic/062
generic/068 generic/069 generic/070 generic/074 generic/075
generic/076 generic/079 generic/083 generic/088 generic/089
generic/091 generic/100 generic/105 generic/117 generic/120
generic/124 generic/126 generic/127 generic/129 generic/130
generic/131 generic/132 generic/133 generic/135 generic/141
generic/169 generic/184 generic/192 generic/204 generic/213
generic/214 generic/215 generic/221 generic/223 generic/224
generic/225 generic/226 generic/228 generic/232 generic/234
generic/236 generic/237 generic/245 generic/246 generic/247
generic/248 generic/249 generic/257 generic/258 generic/263
generic/269 generic/273 generic/274 generic/275 generic/277
generic/280 generic/285 generic/286 generic/294 generic/306
generic/307 generic/308 generic/309 generic/310 generic/311
generic/313 generic/315 generic/318 generic/319 generic/320
generic/321 generic/322 shared/006 shared/032 shared/051 xfs/003
xfs/004 xfs/006 xfs/007 xfs/008 xfs/009 xfs/011 xfs/012 xfs/016
xfs/017 xfs/019 xfs/021 xfs/026 xfs/027 xfs/028 xfs/029 xfs/030
xfs/031 xfs/033 xfs/034 xfs/041 xfs/042 xfs/045 xfs/046 xfs/047
xfs/048 xfs/049 xfs/050 xfs/052 xfs/054 xfs/056 xfs/061 xfs/063
xfs/064 xfs/065 xfs/066 xfs/067 xfs/071 xfs/072 xfs/073 xfs/078
xfs/084 xfs/085 xfs/086 xfs/087 xfs/092 xfs/096 xfs/103 xfs/104
xfs/108 xfs/109 xfs/110 xfs/116 xfs/118 xfs/119 xfs/121 xfs/134
xfs/137 xfs/138 xfs/139 xfs/140 xfs/164 xfs/165 xfs/166 xfs/170
xfs/174 xfs/178 xfs/179 xfs/181 xfs/182 xfs/183 xfs/186 xfs/187
xfs/188 xfs/190 xfs/194 xfs/196 xfs/199 xfs/200 xfs/201 xfs/202
xfs/203 xfs/205 xfs/206 xfs/216 xfs/217 xfs/220 xfs/222 xfs/227
xfs/229 xfs/238 xfs/244 xfs/250 xfs/253 xfs/259 xfs/261 xfs/262
xfs/278 xfs/279 xfs/287 xfs/291 xfs/292 xfs/293 xfs/295 xfs/296
xfs/297 xfs/298 xfs/301 xfs/302 xfs/303 xfs/306
Not run: generic/004 generic/008 generic/009 generic/012 generic/016
generic/017 generic/018 generic/021 generic/022 generic/077
generic/093 generic/097 generic/099 generic/112 generic/113
generic/123 generic/125 generic/128 generic/193 generic/198
generic/207 generic/208 generic/209 generic/210 generic/211
generic/212 generic/219 generic/230 generic/231 generic/233
generic/235 generic/239 generic/240 generic/241 generic/255
generic/256 generic/260 generic/270 generic/288 generic/299
generic/300 generic/312 generic/314 generic/316 generic/317 shared/272
shared/289 shared/298 xfs/001 xfs/002 xfs/005 xfs/010 xfs/013 xfs/014
xfs/035 xfs/040 xfs/044 xfs/057 xfs/058 xfs/059 xfs/060 xfs/090
xfs/094 xfs/095 xfs/122 xfs/148 xfs/149 xfs/167 xfs/180 xfs/189
xfs/191 xfs/195 xfs/197 xfs/242 xfs/252 xfs/266 xfs/281 xfs/282
xfs/283 xfs/290 xfs/299 xfs/300 xfs/304 xfs/305
Failures: generic/306 xfs/229 xfs/250 xfs/301 xfs/302
Failed 5 of 206 tests

On Mon, Apr 27, 2015 at 7:20 AM, Dave Chinner <david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org> wrote:
> On Thu, Apr 23, 2015 at 03:56:36AM +0900, Li Xi wrote:
>> This patch adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR ioctl interface
>> support for ext4. The interface is kept consistent with
>> XFS_IOC_FSGETXATTR/XFS_IOC_FSGETXATTR.
>
> Have you run this patchthrough XFS testing to make sure everything
> sill works?
>
> Cheers,
>
> Dave.
> --
> Dave Chinner
> david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [v14 3/4] ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
       [not found]         ` <CAPTn0cAHOHP060cW8k0-HnyfKdVaUwAVOyLZU43AXtECK6_EaA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-04-28  4:43           ` Dave Chinner
  2015-04-29  5:49             ` Li Xi
  0 siblings, 1 reply; 16+ messages in thread
From: Dave Chinner @ 2015-04-28  4:43 UTC (permalink / raw)
  To: Li Xi
  Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Ext4 Developers List,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Theodore Ts'o,
	Andreas Dilger, Jan Kara, viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn,
	hch-wEGCiKHe2LqWVfeAwA7xHQ, Dmitry Monakhov

On Tue, Apr 28, 2015 at 10:01:07AM +0800, Li Xi wrote:
> Hi Dave,
> 
> I ran xfstests on the kernel with this series of patches.
> Unfortunately, 5 test suits failed. But I don't think they are caused
> by this patch. Following is the result. Please let me know if there is
> any problem about it.
> 
> Output of xfstests:
> 
> FSTYP         -- xfs (non-debug)
> PLATFORM      -- Linux/x86_64 vm15 4.0.0+
> MKFS_OPTIONS  -- -f -bsize=4096 /dev/sdb2
> MOUNT_OPTIONS -- /dev/sdb2 /mnt/scratch
> 
> generic/001 3s ... 2s
> generic/002 0s ... 0s
> generic/003 10s ... 10s
> generic/004     [not run] xfs_io flink support is missing
> generic/005 0s ... 0s
> generic/006 1s ... 0s
> generic/007 0s ... 0s
> generic/008     [not run] xfs_io fzero support is missing
> generic/009     [not run] xfs_io fzero support is missing
> generic/010 1s ... 0s
> generic/011 1s ... 0s
> generic/012     [not run] xfs_io fpunch support is missing
> generic/013 92s ... 90s
> generic/014 3s ... 3s
> generic/015 1s ... 1s
> generic/016     [not run] xfs_io fpunch support is missing
> generic/017     [not run] xfs_io fiemap support is missing
> generic/018     [not run] xfs_io fiemap support is missing

You really need to update your xfsprogs install. You aren't testing
half of what you need to be testing if you are missing basic
functionality like fiemap support (which has been in xfs_io since
2011).

> generic/020 38s ... 31s
> generic/021     [not run] xfs_io fpunch support is missing
> generic/022     [not run] xfs_io fpunch support is missing
> generic/023 1s ... 0s
> generic/024 1s ... 0s
> generic/025 0s ... 0s
> generic/026 0s ... 0s
> generic/027 57s ... 57s
> generic/028 5s ... 5s
> generic/053 1s ... 2s
> generic/062 1s ... 2s
> generic/068 60s ... 61s
> generic/069 4s ... 3s
> generic/070 13s ... 14s
> generic/074 164s ... 162s
> generic/075 87s ... 86s
> generic/076 1s ... 1s
> generic/077     [not run] fsgqa user not defined.

ANd if you don't have this user defined, then several quota tests
don't get run.

> generic/079 1s ... 1s
> generic/083 36s ... 39s
> generic/088 1s ... 0s
> generic/089 4s ... 4s
> generic/091 62s ... 62s
> generic/093     [not run] not suitable for this OS: Linux
> generic/097     [not run] not suitable for this OS: Linux
> generic/099     [not run] not suitable for this OS: Linux
> generic/100 12s ... 12s
> generic/105 0s ... 0s
> generic/112     [not run] fsx not built with AIO for this platform
> generic/113     [not run] aio-stress not built for this platform

Ouch. There's another whole class of functionality you aren't
testing.

> generic/299     [not run]  utility required, skipped this test
> generic/300     [not run] xfs_io fpunch support is missing
> generic/306     - output mismatch (see
> /root/work/quota/ext4_inode_field/xfstests.git/results//generic/306.out.bad)
>     --- tests/generic/306.out    2014-07-16 10:19:26.196995657 +0800
>     +++ /root/work/quota/ext4_inode_field/xfstests.git/results//generic/306.out.bad
>    2015-04-27 22:40:13.365445316 +0800
>     @@ -2,11 +2,9 @@
>      == try to create new file
>      touch: cannot touch 'SCRATCH_MNT/this_should_fail': Read-only file system
>      == pwrite to null device
>     -wrote 512/512 bytes at offset 0
>     -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>     +xfs_io: specified file ["/mnt/scratch/devnull"] is not on an XFS filesystem
>      == pread from zero device
>     ...
>     (Run 'diff -u tests/generic/306.out
> /root/work/quota/ext4_inode_field/xfstests.git/results//generic/306.out.bad'
>  to see the entire diff)

That's caused by having a very old xfs_io.

> xfs/229 134s ... [failed, exit status 23] - output mismatch (see
> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/229.out.bad)
>     --- tests/xfs/229.out    2014-07-16 10:19:26.215995657 +0800
>     +++ /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/229.out.bad
>    2015-04-27 23:25:48.709093428 +0800
>     @@ -1,4 +1,31 @@
>      QA output created by 229
>      generating 10 files
>     +Write did not return correct amount
>     +Write did not return correct amount
>     +Write did not return correct amount
>     +Write did not return correct amount
>      comparing files

Can't say that I've seen that one fail for a long time. I can't say
anything useful about it, however, given how old your xfsprogs
installation is.

>     ...
>     (Run 'diff -u tests/xfs/229.out
> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/229.out.bad'
>  to see the entire diff)
> xfs/238 1s ... 1s
> xfs/242     [not run] zero command not supported
> xfs/244 2s ... 2s
> xfs/250     [failed, exit status 1] - output mismatch (see
> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/250.out.bad)
>     --- tests/xfs/250.out    2014-07-16 10:19:26.215995657 +0800
>     +++ /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/250.out.bad
>    2015-04-27 23:26:15.137452337 +0800
>     @@ -11,4 +11,4 @@
>      *** preallocate large file
>      *** unmount loop filesystem
>      *** check loop filesystem
>     -*** done
>     +_check_xfs_filesystem: filesystem on /mnt/test/250.fs is
> inconsistent (r) (see
> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/250.full)
>     ...
>     (Run 'diff -u tests/xfs/250.out
> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/250.out.bad'
>  to see the entire diff)

Your xfstests is not up to date. This is fixed by commit ee6ad7f
("xfs/049: umount -d fails when kernel wins teardown race").

> xfs/301     - output mismatch (see
> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/301.out.bad)
>     --- tests/xfs/301.out    2014-07-16 10:19:26.217995657 +0800
>     +++ /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/301.out.bad
>    2015-04-27 23:33:33.629182381 +0800
>     @@ -29,18 +29,21 @@
>      Attribute "attr4" had a 10 byte value for DUMP_DIR/sub/biggg:
>      some_text4
>      EAs on restore
>     +getfattr: /mnt/scratch/restoredir/dumpdir: No such file or directory
>     +getfattr: /mnt/scratch/restoredir/dumpdir: No such file or directory
>      User names
>     -Attribute "attr5" had a 8 byte value for DUMP_DIR/dir:
>     ...
>     (Run 'diff -u tests/xfs/301.out

$ ./lsqa.pl tests/xfs/301
FS QA Test No. 301

Verify multi-stream xfsdump/restore preserves extended attributes

$

Your xfsdump package is out of date and needs upgrading.

> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/301.out.bad'
>  to see the entire diff)
> xfs/302     [failed, exit status 1] - output mismatch (see
> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/302.out.bad)
>     --- tests/xfs/302.out    2014-07-16 10:19:26.217995657 +0800
>     +++ /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/302.out.bad
>    2015-04-27 23:33:46.102767709 +0800
>     @@ -1,2 +1,4 @@
>      QA output created by 302
>      Silence is golden.
>     +dump failed
>     +(see /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/302.full
> for details)
>     ...
>     (Run 'diff -u tests/xfs/302.out
> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/302.out.bad'
>  to see the entire diff)

Same again.

You need to upgrade everything to current xfstests/xfsprogs/xfsdump
and retest *everything*. That means rerunning all your ext4 testing,
too, because you're not exercising all the cases where the
interesting accounting bugs lie (i.e. in fallocate operations).

I'd also suggest that you run the tests using MOUNT_OPTIONS="-o
pquota" after setting up default configurations for TEST_MNT and
SCRATCH_MNT so that you actually give the project quota code a
significant amount of work to do, and do the same for ext4,
otherwise you're not really testing it at all when you run xfstests
on ext4....

Cheers,

Dave.
-- 
Dave Chinner
david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [v14 3/4] ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
  2015-04-28  4:43           ` Dave Chinner
@ 2015-04-29  5:49             ` Li Xi
  2015-04-29  7:59               ` Jan Kara
  0 siblings, 1 reply; 16+ messages in thread
From: Li Xi @ 2015-04-29  5:49 UTC (permalink / raw)
  To: Dave Chinner
  Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Ext4 Developers List,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Theodore Ts'o,
	Andreas Dilger, Jan Kara, viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn,
	hch-wEGCiKHe2LqWVfeAwA7xHQ, Dmitry Monakhov

Hi Dave,

Thanks for the advices. I tried to run latest xfstests again. However,
the kernel crashed when runing generic/051 generic/054 and
generic/055. And please note that the kernel also crashed on original
linux-4.0 without any of my patches. Following is one of the dump
stack:

run fstests generic/055 at 2015-04-29 13:43:39
------------[ cut here ]------------
WARNING: CPU: 0 PID: 31915 at lib/list_debug.c:33 __list_add+0xbe/0xd0()
list_add corruption. prev->next should be next (ffffffff81e05018), but
was           (null). (prev=ffff8800d8ff3ca0).
Modules linked in: dm_flakey xfs exportfs libcrc32c nfsv3 nfs_acl
rpcsec_gss_krb5 auth_rpcgss oid_registry nfsv4 nfs fscache lockd grace
sunrpc ipv6 dm_mirror dm_region_hash dm_log dm_mod ppdev floppy
parport_pc parport microcode pcspkr virtio_balloon sg 8139too 8139cp
mii i2c_piix4 i2c_core ext4 jbd2 mbcache sr_mod cdrom sd_mod pata_acpi
ata_generic ata_piix virtio_pci virtio_ring virtio [last unloaded:
speedstep_lib]
CPU: 0 PID: 31915 Comm: kworker/0:0 Not tainted 4.0.0+ #1
Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007
Workqueue: events vmstat_shepherd
 0000000000000021 ffff8800db177bf8 ffffffff815ccaf6 0000000000000021
 ffff8800db177c48 ffff8800db177c38 ffffffff81059fc5 ffff8800db177c38
 ffffffff81a8d480 ffffffff81e05018 ffff8800d8ff3ca0 0000000000000000
Call Trace:
 [<ffffffff815ccaf6>] dump_stack+0x48/0x5a
 [<ffffffff81059fc5>] warn_slowpath_common+0x95/0xe0
 [<ffffffff8105a0c6>] warn_slowpath_fmt+0x46/0x70
 [<ffffffff812c04fe>] __list_add+0xbe/0xd0
 [<ffffffff810bb84b>] __internal_add_timer+0x9b/0x110
 [<ffffffff810bb8f9>] internal_add_timer+0x39/0x90
 [<ffffffff810bd8c9>] mod_timer+0xf9/0x1d0
 [<ffffffff810bd9b8>] add_timer+0x18/0x30
 [<ffffffff81071a22>] __queue_delayed_work+0x92/0x1a0
 [<ffffffff81071bcd>] queue_delayed_work_on+0x1d/0x40
 [<ffffffff81160d5c>] vmstat_shepherd+0x10c/0x120
 [<ffffffff810722ed>] process_one_work+0x14d/0x440
 [<ffffffff810726ff>] worker_thread+0x11f/0x3d0
 [<ffffffff815ccfaf>] ? __schedule+0x36f/0x800
 [<ffffffff810725e0>] ? process_one_work+0x440/0x440
 [<ffffffff810725e0>] ? process_one_work+0x440/0x440
 [<ffffffff810774ce>] kthread+0xce/0xf0
 [<ffffffff8104d96e>] ? __do_page_fault+0x17e/0x430
 [<ffffffff81077400>] ? kthread_freezable_should_stop+0x70/0x70
 [<ffffffff815d1052>] ret_from_fork+0x42/0x70
 [<ffffffff81077400>] ? kthread_freezable_should_stop+0x70/0x70
---[ end trace 97c6b752be15ac57 ]---
XFS (sdb2): Mounting V4 Filesystem
XFS (sdb2): Ending clean mount
XFS (sdb2): Quotacheck needed: Please wait.
XFS (sdb2): Quotacheck: Done.
XFS (sdb2): xfs_log_force: error -5 returned.
XFS (sdb2): xfs_log_force: error -5 returned.
XFS (sdb2): xfs_log_force: error -5 returned.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
IP: [<ffffffff810bbc88>] get_next_timer_interrupt+0x158/0x230
PGD d8e7a067 PUD db654067 PMD 0
Oops: 0000 [#1] SMP
Modules linked in: dm_flakey xfs exportfs libcrc32c nfsv3 nfs_acl
rpcsec_gss_krb5 auth_rpcgss oid_registry nfsv4 nfs fscache lockd grace
sunrpc ipv6 dm_mirror dm_region_hash dm_log dm_mod ppdev floppy
parport_pc parport microcode pcspkr virtio_balloon sg 8139too 8139cp
mii i2c_piix4 i2c_core ext4 jbd2 mbcache sr_mod cdrom sd_mod pata_acpi
ata_generic ata_piix virtio_pci virtio_ring virtio [last unloaded:
speedstep_lib]
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W       4.0.0+ #1
Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007
task: ffffffff81a134a0 ti: ffffffff81a00000 task.ti: ffffffff81a00000
RIP: 0010:[<ffffffff810bbc88>]  [<ffffffff810bbc88>]
get_next_timer_interrupt+0x158/0x230
RSP: 0018:ffff88011fc03e48  EFLAGS: 00010013
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff81e05008
RDX: 0000000000000001 RSI: 0000000000000011 RDI: ffffffff81e04ef8
RBP: ffff88011fc03ea8 R08: 0000000000000011 R09: 0000000001000551
R10: ffff88011fc03e60 R11: ffff88011fc03e78 R12: 0000000140055030
R13: 0000000100055031 R14: ffffffff81e03ec0 R15: 0000000000000040
FS:  0000000000000000(0000) GS:ffff88011fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000018 CR3: 00000000d8d8f000 CR4: 00000000000006f0
Stack:
 ffff88011fc03e88 ffffffff810bbdf7 ffffffff81e04ef8 ffffffff81e052f8
 ffffffff81e056f8 ffffffff81e05af8 0000000000000000 ffff88011fc0f8a0
 0000000100055031 0000000000000000 ffff88011fc0bfc0 ffffffff81a00000
Call Trace:
 <IRQ>
 [<ffffffff810bbdf7>] ? call_timer_fn+0x47/0x110
 [<ffffffff810cdf1d>] tick_nohz_stop_sched_tick+0x1cd/0x310
 [<ffffffff810ce108>] __tick_nohz_idle_enter+0xa8/0x150
 [<ffffffff810ce1dd>] tick_nohz_irq_exit+0x2d/0x40
 [<ffffffff8105deaf>] irq_exit+0x9f/0xc0
 [<ffffffff815d34aa>] smp_apic_timer_interrupt+0x4a/0x59
 [<ffffffff815d1a3b>] apic_timer_interrupt+0x6b/0x70
 <EOI>
 [<ffffffff8100f100>] ? default_idle+0x20/0xb0
 [<ffffffff8100e74f>] arch_cpu_idle+0xf/0x20
 [<ffffffff810986a9>] cpuidle_idle_call+0x89/0x220
 [<ffffffff81078232>] ? __atomic_notifier_call_chain+0x12/0x20
 [<ffffffff81098975>] cpu_idle_loop+0x135/0x1f0
 [<ffffffff81098a43>] cpu_startup_entry+0x13/0x20
 [<ffffffff815c5e1c>] rest_init+0x7c/0x80
 [<ffffffff81b4e372>] start_kernel+0x3d8/0x3df
 [<ffffffff81b4ddb8>] ? set_init_arg+0x5d/0x5d
 [<ffffffff815cb906>] ? memblock_reserve+0x4c/0x51
 [<ffffffff81b4d5ad>] x86_64_start_reservations+0x2a/0x2c
 [<ffffffff81b4d6e4>] x86_64_start_kernel+0x135/0x13c
Code: 00 48 89 45 c8 45 89 c8 41 83 e0 3f 44 89 c6 0f 1f 40 00 48 63
ce 48 c1 e1 04 48 8b 04 39 48 8d 0c 0f 48 39 c8 74 22 0f 1f 40 00 <f6>
40 18 01 75 10 48 8b 50 10 48 39 da 48 0f 48 da ba 01 00 00
RIP  [<ffffffff810bbc88>] get_next_timer_interrupt+0x158/0x230
 RSP <ffff88011fc03e48>
CR2: 0000000000000018

On Tue, Apr 28, 2015 at 12:43 PM, Dave Chinner <david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org> wrote:
> On Tue, Apr 28, 2015 at 10:01:07AM +0800, Li Xi wrote:
>> Hi Dave,
>>
>> I ran xfstests on the kernel with this series of patches.
>> Unfortunately, 5 test suits failed. But I don't think they are caused
>> by this patch. Following is the result. Please let me know if there is
>> any problem about it.
>>
>> Output of xfstests:
>>
>> FSTYP         -- xfs (non-debug)
>> PLATFORM      -- Linux/x86_64 vm15 4.0.0+
>> MKFS_OPTIONS  -- -f -bsize=4096 /dev/sdb2
>> MOUNT_OPTIONS -- /dev/sdb2 /mnt/scratch
>>
>> generic/001 3s ... 2s
>> generic/002 0s ... 0s
>> generic/003 10s ... 10s
>> generic/004     [not run] xfs_io flink support is missing
>> generic/005 0s ... 0s
>> generic/006 1s ... 0s
>> generic/007 0s ... 0s
>> generic/008     [not run] xfs_io fzero support is missing
>> generic/009     [not run] xfs_io fzero support is missing
>> generic/010 1s ... 0s
>> generic/011 1s ... 0s
>> generic/012     [not run] xfs_io fpunch support is missing
>> generic/013 92s ... 90s
>> generic/014 3s ... 3s
>> generic/015 1s ... 1s
>> generic/016     [not run] xfs_io fpunch support is missing
>> generic/017     [not run] xfs_io fiemap support is missing
>> generic/018     [not run] xfs_io fiemap support is missing
>
> You really need to update your xfsprogs install. You aren't testing
> half of what you need to be testing if you are missing basic
> functionality like fiemap support (which has been in xfs_io since
> 2011).
>
>> generic/020 38s ... 31s
>> generic/021     [not run] xfs_io fpunch support is missing
>> generic/022     [not run] xfs_io fpunch support is missing
>> generic/023 1s ... 0s
>> generic/024 1s ... 0s
>> generic/025 0s ... 0s
>> generic/026 0s ... 0s
>> generic/027 57s ... 57s
>> generic/028 5s ... 5s
>> generic/053 1s ... 2s
>> generic/062 1s ... 2s
>> generic/068 60s ... 61s
>> generic/069 4s ... 3s
>> generic/070 13s ... 14s
>> generic/074 164s ... 162s
>> generic/075 87s ... 86s
>> generic/076 1s ... 1s
>> generic/077     [not run] fsgqa user not defined.
>
> ANd if you don't have this user defined, then several quota tests
> don't get run.
>
>> generic/079 1s ... 1s
>> generic/083 36s ... 39s
>> generic/088 1s ... 0s
>> generic/089 4s ... 4s
>> generic/091 62s ... 62s
>> generic/093     [not run] not suitable for this OS: Linux
>> generic/097     [not run] not suitable for this OS: Linux
>> generic/099     [not run] not suitable for this OS: Linux
>> generic/100 12s ... 12s
>> generic/105 0s ... 0s
>> generic/112     [not run] fsx not built with AIO for this platform
>> generic/113     [not run] aio-stress not built for this platform
>
> Ouch. There's another whole class of functionality you aren't
> testing.
>
>> generic/299     [not run]  utility required, skipped this test
>> generic/300     [not run] xfs_io fpunch support is missing
>> generic/306     - output mismatch (see
>> /root/work/quota/ext4_inode_field/xfstests.git/results//generic/306.out.bad)
>>     --- tests/generic/306.out    2014-07-16 10:19:26.196995657 +0800
>>     +++ /root/work/quota/ext4_inode_field/xfstests.git/results//generic/306.out.bad
>>    2015-04-27 22:40:13.365445316 +0800
>>     @@ -2,11 +2,9 @@
>>      == try to create new file
>>      touch: cannot touch 'SCRATCH_MNT/this_should_fail': Read-only file system
>>      == pwrite to null device
>>     -wrote 512/512 bytes at offset 0
>>     -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>>     +xfs_io: specified file ["/mnt/scratch/devnull"] is not on an XFS filesystem
>>      == pread from zero device
>>     ...
>>     (Run 'diff -u tests/generic/306.out
>> /root/work/quota/ext4_inode_field/xfstests.git/results//generic/306.out.bad'
>>  to see the entire diff)
>
> That's caused by having a very old xfs_io.
>
>> xfs/229 134s ... [failed, exit status 23] - output mismatch (see
>> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/229.out.bad)
>>     --- tests/xfs/229.out    2014-07-16 10:19:26.215995657 +0800
>>     +++ /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/229.out.bad
>>    2015-04-27 23:25:48.709093428 +0800
>>     @@ -1,4 +1,31 @@
>>      QA output created by 229
>>      generating 10 files
>>     +Write did not return correct amount
>>     +Write did not return correct amount
>>     +Write did not return correct amount
>>     +Write did not return correct amount
>>      comparing files
>
> Can't say that I've seen that one fail for a long time. I can't say
> anything useful about it, however, given how old your xfsprogs
> installation is.
>
>>     ...
>>     (Run 'diff -u tests/xfs/229.out
>> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/229.out.bad'
>>  to see the entire diff)
>> xfs/238 1s ... 1s
>> xfs/242     [not run] zero command not supported
>> xfs/244 2s ... 2s
>> xfs/250     [failed, exit status 1] - output mismatch (see
>> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/250.out.bad)
>>     --- tests/xfs/250.out    2014-07-16 10:19:26.215995657 +0800
>>     +++ /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/250.out.bad
>>    2015-04-27 23:26:15.137452337 +0800
>>     @@ -11,4 +11,4 @@
>>      *** preallocate large file
>>      *** unmount loop filesystem
>>      *** check loop filesystem
>>     -*** done
>>     +_check_xfs_filesystem: filesystem on /mnt/test/250.fs is
>> inconsistent (r) (see
>> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/250.full)
>>     ...
>>     (Run 'diff -u tests/xfs/250.out
>> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/250.out.bad'
>>  to see the entire diff)
>
> Your xfstests is not up to date. This is fixed by commit ee6ad7f
> ("xfs/049: umount -d fails when kernel wins teardown race").
>
>> xfs/301     - output mismatch (see
>> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/301.out.bad)
>>     --- tests/xfs/301.out    2014-07-16 10:19:26.217995657 +0800
>>     +++ /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/301.out.bad
>>    2015-04-27 23:33:33.629182381 +0800
>>     @@ -29,18 +29,21 @@
>>      Attribute "attr4" had a 10 byte value for DUMP_DIR/sub/biggg:
>>      some_text4
>>      EAs on restore
>>     +getfattr: /mnt/scratch/restoredir/dumpdir: No such file or directory
>>     +getfattr: /mnt/scratch/restoredir/dumpdir: No such file or directory
>>      User names
>>     -Attribute "attr5" had a 8 byte value for DUMP_DIR/dir:
>>     ...
>>     (Run 'diff -u tests/xfs/301.out
>
> $ ./lsqa.pl tests/xfs/301
> FS QA Test No. 301
>
> Verify multi-stream xfsdump/restore preserves extended attributes
>
> $
>
> Your xfsdump package is out of date and needs upgrading.
>
>> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/301.out.bad'
>>  to see the entire diff)
>> xfs/302     [failed, exit status 1] - output mismatch (see
>> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/302.out.bad)
>>     --- tests/xfs/302.out    2014-07-16 10:19:26.217995657 +0800
>>     +++ /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/302.out.bad
>>    2015-04-27 23:33:46.102767709 +0800
>>     @@ -1,2 +1,4 @@
>>      QA output created by 302
>>      Silence is golden.
>>     +dump failed
>>     +(see /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/302.full
>> for details)
>>     ...
>>     (Run 'diff -u tests/xfs/302.out
>> /root/work/quota/ext4_inode_field/xfstests.git/results//xfs/302.out.bad'
>>  to see the entire diff)
>
> Same again.
>
> You need to upgrade everything to current xfstests/xfsprogs/xfsdump
> and retest *everything*. That means rerunning all your ext4 testing,
> too, because you're not exercising all the cases where the
> interesting accounting bugs lie (i.e. in fallocate operations).
>
> I'd also suggest that you run the tests using MOUNT_OPTIONS="-o
> pquota" after setting up default configurations for TEST_MNT and
> SCRATCH_MNT so that you actually give the project quota code a
> significant amount of work to do, and do the same for ext4,
> otherwise you're not really testing it at all when you run xfstests
> on ext4....
>
> Cheers,
>
> Dave.
> --
> Dave Chinner
> david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [v14 3/4] ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
  2015-04-29  5:49             ` Li Xi
@ 2015-04-29  7:59               ` Jan Kara
  2015-04-29 11:45                 ` Li Xi
  0 siblings, 1 reply; 16+ messages in thread
From: Jan Kara @ 2015-04-29  7:59 UTC (permalink / raw)
  To: Li Xi
  Cc: Dave Chinner, linux-fsdevel, Ext4 Developers List,
	Theodore Ts'o, Andreas Dilger, Jan Kara, viro, hch,
	Dmitry Monakhov, John Stultz, Thomas Gleixner

  Hi,

On Wed 29-04-15 13:49:08, Li Xi wrote:
> Thanks for the advices. I tried to run latest xfstests again. However,
  Dave actually asked you to update 'xfsprogs' not xfstests. Not that
updating xfstests would be a wrong thing to do but you still need to update
xfsprogs for xfstests to be able to run some tests. But that's unrelated to
the oops you reported below.

> the kernel crashed when runing generic/051 generic/054 and
> generic/055. And please note that the kernel also crashed on original
> linux-4.0 without any of my patches. Following is one of the dump
> stack:
  It looks like some issue with timers. John, Thomas, any idea?

								Honza

> run fstests generic/055 at 2015-04-29 13:43:39
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 31915 at lib/list_debug.c:33 __list_add+0xbe/0xd0()
> list_add corruption. prev->next should be next (ffffffff81e05018), but
> was           (null). (prev=ffff8800d8ff3ca0).
> Modules linked in: dm_flakey xfs exportfs libcrc32c nfsv3 nfs_acl
> rpcsec_gss_krb5 auth_rpcgss oid_registry nfsv4 nfs fscache lockd grace
> sunrpc ipv6 dm_mirror dm_region_hash dm_log dm_mod ppdev floppy
> parport_pc parport microcode pcspkr virtio_balloon sg 8139too 8139cp
> mii i2c_piix4 i2c_core ext4 jbd2 mbcache sr_mod cdrom sd_mod pata_acpi
> ata_generic ata_piix virtio_pci virtio_ring virtio [last unloaded:
> speedstep_lib]
> CPU: 0 PID: 31915 Comm: kworker/0:0 Not tainted 4.0.0+ #1
> Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007
> Workqueue: events vmstat_shepherd
>  0000000000000021 ffff8800db177bf8 ffffffff815ccaf6 0000000000000021
>  ffff8800db177c48 ffff8800db177c38 ffffffff81059fc5 ffff8800db177c38
>  ffffffff81a8d480 ffffffff81e05018 ffff8800d8ff3ca0 0000000000000000
> Call Trace:
>  [<ffffffff815ccaf6>] dump_stack+0x48/0x5a
>  [<ffffffff81059fc5>] warn_slowpath_common+0x95/0xe0
>  [<ffffffff8105a0c6>] warn_slowpath_fmt+0x46/0x70
>  [<ffffffff812c04fe>] __list_add+0xbe/0xd0
>  [<ffffffff810bb84b>] __internal_add_timer+0x9b/0x110
>  [<ffffffff810bb8f9>] internal_add_timer+0x39/0x90
>  [<ffffffff810bd8c9>] mod_timer+0xf9/0x1d0
>  [<ffffffff810bd9b8>] add_timer+0x18/0x30
>  [<ffffffff81071a22>] __queue_delayed_work+0x92/0x1a0
>  [<ffffffff81071bcd>] queue_delayed_work_on+0x1d/0x40
>  [<ffffffff81160d5c>] vmstat_shepherd+0x10c/0x120
>  [<ffffffff810722ed>] process_one_work+0x14d/0x440
>  [<ffffffff810726ff>] worker_thread+0x11f/0x3d0
>  [<ffffffff815ccfaf>] ? __schedule+0x36f/0x800
>  [<ffffffff810725e0>] ? process_one_work+0x440/0x440
>  [<ffffffff810725e0>] ? process_one_work+0x440/0x440
>  [<ffffffff810774ce>] kthread+0xce/0xf0
>  [<ffffffff8104d96e>] ? __do_page_fault+0x17e/0x430
>  [<ffffffff81077400>] ? kthread_freezable_should_stop+0x70/0x70
>  [<ffffffff815d1052>] ret_from_fork+0x42/0x70
>  [<ffffffff81077400>] ? kthread_freezable_should_stop+0x70/0x70
> ---[ end trace 97c6b752be15ac57 ]---
> XFS (sdb2): Mounting V4 Filesystem
> XFS (sdb2): Ending clean mount
> XFS (sdb2): Quotacheck needed: Please wait.
> XFS (sdb2): Quotacheck: Done.
> XFS (sdb2): xfs_log_force: error -5 returned.
> XFS (sdb2): xfs_log_force: error -5 returned.
> XFS (sdb2): xfs_log_force: error -5 returned.
> BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
> IP: [<ffffffff810bbc88>] get_next_timer_interrupt+0x158/0x230
> PGD d8e7a067 PUD db654067 PMD 0
> Oops: 0000 [#1] SMP
> Modules linked in: dm_flakey xfs exportfs libcrc32c nfsv3 nfs_acl
> rpcsec_gss_krb5 auth_rpcgss oid_registry nfsv4 nfs fscache lockd grace
> sunrpc ipv6 dm_mirror dm_region_hash dm_log dm_mod ppdev floppy
> parport_pc parport microcode pcspkr virtio_balloon sg 8139too 8139cp
> mii i2c_piix4 i2c_core ext4 jbd2 mbcache sr_mod cdrom sd_mod pata_acpi
> ata_generic ata_piix virtio_pci virtio_ring virtio [last unloaded:
> speedstep_lib]
> CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W       4.0.0+ #1
> Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007
> task: ffffffff81a134a0 ti: ffffffff81a00000 task.ti: ffffffff81a00000
> RIP: 0010:[<ffffffff810bbc88>]  [<ffffffff810bbc88>]
> get_next_timer_interrupt+0x158/0x230
> RSP: 0018:ffff88011fc03e48  EFLAGS: 00010013
> RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff81e05008
> RDX: 0000000000000001 RSI: 0000000000000011 RDI: ffffffff81e04ef8
> RBP: ffff88011fc03ea8 R08: 0000000000000011 R09: 0000000001000551
> R10: ffff88011fc03e60 R11: ffff88011fc03e78 R12: 0000000140055030
> R13: 0000000100055031 R14: ffffffff81e03ec0 R15: 0000000000000040
> FS:  0000000000000000(0000) GS:ffff88011fc00000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> CR2: 0000000000000018 CR3: 00000000d8d8f000 CR4: 00000000000006f0
> Stack:
>  ffff88011fc03e88 ffffffff810bbdf7 ffffffff81e04ef8 ffffffff81e052f8
>  ffffffff81e056f8 ffffffff81e05af8 0000000000000000 ffff88011fc0f8a0
>  0000000100055031 0000000000000000 ffff88011fc0bfc0 ffffffff81a00000
> Call Trace:
>  <IRQ>
>  [<ffffffff810bbdf7>] ? call_timer_fn+0x47/0x110
>  [<ffffffff810cdf1d>] tick_nohz_stop_sched_tick+0x1cd/0x310
>  [<ffffffff810ce108>] __tick_nohz_idle_enter+0xa8/0x150
>  [<ffffffff810ce1dd>] tick_nohz_irq_exit+0x2d/0x40
>  [<ffffffff8105deaf>] irq_exit+0x9f/0xc0
>  [<ffffffff815d34aa>] smp_apic_timer_interrupt+0x4a/0x59
>  [<ffffffff815d1a3b>] apic_timer_interrupt+0x6b/0x70
>  <EOI>
>  [<ffffffff8100f100>] ? default_idle+0x20/0xb0
>  [<ffffffff8100e74f>] arch_cpu_idle+0xf/0x20
>  [<ffffffff810986a9>] cpuidle_idle_call+0x89/0x220
>  [<ffffffff81078232>] ? __atomic_notifier_call_chain+0x12/0x20
>  [<ffffffff81098975>] cpu_idle_loop+0x135/0x1f0
>  [<ffffffff81098a43>] cpu_startup_entry+0x13/0x20
>  [<ffffffff815c5e1c>] rest_init+0x7c/0x80
>  [<ffffffff81b4e372>] start_kernel+0x3d8/0x3df
>  [<ffffffff81b4ddb8>] ? set_init_arg+0x5d/0x5d
>  [<ffffffff815cb906>] ? memblock_reserve+0x4c/0x51
>  [<ffffffff81b4d5ad>] x86_64_start_reservations+0x2a/0x2c
>  [<ffffffff81b4d6e4>] x86_64_start_kernel+0x135/0x13c
> Code: 00 48 89 45 c8 45 89 c8 41 83 e0 3f 44 89 c6 0f 1f 40 00 48 63
> ce 48 c1 e1 04 48 8b 04 39 48 8d 0c 0f 48 39 c8 74 22 0f 1f 40 00 <f6>
> 40 18 01 75 10 48 8b 50 10 48 39 da 48 0f 48 da ba 01 00 00
> RIP  [<ffffffff810bbc88>] get_next_timer_interrupt+0x158/0x230
>  RSP <ffff88011fc03e48>
> CR2: 0000000000000018
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [v14 3/4] ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
  2015-04-29  7:59               ` Jan Kara
@ 2015-04-29 11:45                 ` Li Xi
  2015-04-29 22:07                   ` Dave Chinner
  0 siblings, 1 reply; 16+ messages in thread
From: Li Xi @ 2015-04-29 11:45 UTC (permalink / raw)
  To: Jan Kara
  Cc: Dave Chinner, linux-fsdevel, Ext4 Developers List,
	Theodore Ts'o, Andreas Dilger, viro, hch, Dmitry Monakhov,
	John Stultz, Thomas Gleixner

On Wed, Apr 29, 2015 at 3:59 PM, Jan Kara <jack@suse.cz> wrote:
>   Hi,
>
> On Wed 29-04-15 13:49:08, Li Xi wrote:
>> Thanks for the advices. I tried to run latest xfstests again. However,
>   Dave actually asked you to update 'xfsprogs' not xfstests. Not that
> updating xfstests would be a wrong thing to do but you still need to update
> xfsprogs for xfstests to be able to run some tests. But that's unrelated to
> the oops you reported below.
Understood. I updated both xfstests and xfsprogs to the latest version from git
repository. However, I didn't update xfsdump because of a build failure caused
by missing definitons of 'min' and 'max'
>
>> the kernel crashed when runing generic/051 generic/054 and
>> generic/055. And please note that the kernel also crashed on original
>> linux-4.0 without any of my patches. Following is one of the dump
>> stack:
>   It looks like some issue with timers. John, Thomas, any idea?
>
>                                                                 Honza
>
>> run fstests generic/055 at 2015-04-29 13:43:39
>> ------------[ cut here ]------------
>> WARNING: CPU: 0 PID: 31915 at lib/list_debug.c:33 __list_add+0xbe/0xd0()
>> list_add corruption. prev->next should be next (ffffffff81e05018), but
>> was           (null). (prev=ffff8800d8ff3ca0).
>> Modules linked in: dm_flakey xfs exportfs libcrc32c nfsv3 nfs_acl
>> rpcsec_gss_krb5 auth_rpcgss oid_registry nfsv4 nfs fscache lockd grace
>> sunrpc ipv6 dm_mirror dm_region_hash dm_log dm_mod ppdev floppy
>> parport_pc parport microcode pcspkr virtio_balloon sg 8139too 8139cp
>> mii i2c_piix4 i2c_core ext4 jbd2 mbcache sr_mod cdrom sd_mod pata_acpi
>> ata_generic ata_piix virtio_pci virtio_ring virtio [last unloaded:
>> speedstep_lib]
>> CPU: 0 PID: 31915 Comm: kworker/0:0 Not tainted 4.0.0+ #1
>> Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007
>> Workqueue: events vmstat_shepherd
>>  0000000000000021 ffff8800db177bf8 ffffffff815ccaf6 0000000000000021
>>  ffff8800db177c48 ffff8800db177c38 ffffffff81059fc5 ffff8800db177c38
>>  ffffffff81a8d480 ffffffff81e05018 ffff8800d8ff3ca0 0000000000000000
>> Call Trace:
>>  [<ffffffff815ccaf6>] dump_stack+0x48/0x5a
>>  [<ffffffff81059fc5>] warn_slowpath_common+0x95/0xe0
>>  [<ffffffff8105a0c6>] warn_slowpath_fmt+0x46/0x70
>>  [<ffffffff812c04fe>] __list_add+0xbe/0xd0
>>  [<ffffffff810bb84b>] __internal_add_timer+0x9b/0x110
>>  [<ffffffff810bb8f9>] internal_add_timer+0x39/0x90
>>  [<ffffffff810bd8c9>] mod_timer+0xf9/0x1d0
>>  [<ffffffff810bd9b8>] add_timer+0x18/0x30
>>  [<ffffffff81071a22>] __queue_delayed_work+0x92/0x1a0
>>  [<ffffffff81071bcd>] queue_delayed_work_on+0x1d/0x40
>>  [<ffffffff81160d5c>] vmstat_shepherd+0x10c/0x120
>>  [<ffffffff810722ed>] process_one_work+0x14d/0x440
>>  [<ffffffff810726ff>] worker_thread+0x11f/0x3d0
>>  [<ffffffff815ccfaf>] ? __schedule+0x36f/0x800
>>  [<ffffffff810725e0>] ? process_one_work+0x440/0x440
>>  [<ffffffff810725e0>] ? process_one_work+0x440/0x440
>>  [<ffffffff810774ce>] kthread+0xce/0xf0
>>  [<ffffffff8104d96e>] ? __do_page_fault+0x17e/0x430
>>  [<ffffffff81077400>] ? kthread_freezable_should_stop+0x70/0x70
>>  [<ffffffff815d1052>] ret_from_fork+0x42/0x70
>>  [<ffffffff81077400>] ? kthread_freezable_should_stop+0x70/0x70
>> ---[ end trace 97c6b752be15ac57 ]---
>> XFS (sdb2): Mounting V4 Filesystem
>> XFS (sdb2): Ending clean mount
>> XFS (sdb2): Quotacheck needed: Please wait.
>> XFS (sdb2): Quotacheck: Done.
>> XFS (sdb2): xfs_log_force: error -5 returned.
>> XFS (sdb2): xfs_log_force: error -5 returned.
>> XFS (sdb2): xfs_log_force: error -5 returned.
>> BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
>> IP: [<ffffffff810bbc88>] get_next_timer_interrupt+0x158/0x230
>> PGD d8e7a067 PUD db654067 PMD 0
>> Oops: 0000 [#1] SMP
>> Modules linked in: dm_flakey xfs exportfs libcrc32c nfsv3 nfs_acl
>> rpcsec_gss_krb5 auth_rpcgss oid_registry nfsv4 nfs fscache lockd grace
>> sunrpc ipv6 dm_mirror dm_region_hash dm_log dm_mod ppdev floppy
>> parport_pc parport microcode pcspkr virtio_balloon sg 8139too 8139cp
>> mii i2c_piix4 i2c_core ext4 jbd2 mbcache sr_mod cdrom sd_mod pata_acpi
>> ata_generic ata_piix virtio_pci virtio_ring virtio [last unloaded:
>> speedstep_lib]
>> CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W       4.0.0+ #1
>> Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007
>> task: ffffffff81a134a0 ti: ffffffff81a00000 task.ti: ffffffff81a00000
>> RIP: 0010:[<ffffffff810bbc88>]  [<ffffffff810bbc88>]
>> get_next_timer_interrupt+0x158/0x230
>> RSP: 0018:ffff88011fc03e48  EFLAGS: 00010013
>> RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff81e05008
>> RDX: 0000000000000001 RSI: 0000000000000011 RDI: ffffffff81e04ef8
>> RBP: ffff88011fc03ea8 R08: 0000000000000011 R09: 0000000001000551
>> R10: ffff88011fc03e60 R11: ffff88011fc03e78 R12: 0000000140055030
>> R13: 0000000100055031 R14: ffffffff81e03ec0 R15: 0000000000000040
>> FS:  0000000000000000(0000) GS:ffff88011fc00000(0000) knlGS:0000000000000000
>> CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
>> CR2: 0000000000000018 CR3: 00000000d8d8f000 CR4: 00000000000006f0
>> Stack:
>>  ffff88011fc03e88 ffffffff810bbdf7 ffffffff81e04ef8 ffffffff81e052f8
>>  ffffffff81e056f8 ffffffff81e05af8 0000000000000000 ffff88011fc0f8a0
>>  0000000100055031 0000000000000000 ffff88011fc0bfc0 ffffffff81a00000
>> Call Trace:
>>  <IRQ>
>>  [<ffffffff810bbdf7>] ? call_timer_fn+0x47/0x110
>>  [<ffffffff810cdf1d>] tick_nohz_stop_sched_tick+0x1cd/0x310
>>  [<ffffffff810ce108>] __tick_nohz_idle_enter+0xa8/0x150
>>  [<ffffffff810ce1dd>] tick_nohz_irq_exit+0x2d/0x40
>>  [<ffffffff8105deaf>] irq_exit+0x9f/0xc0
>>  [<ffffffff815d34aa>] smp_apic_timer_interrupt+0x4a/0x59
>>  [<ffffffff815d1a3b>] apic_timer_interrupt+0x6b/0x70
>>  <EOI>
>>  [<ffffffff8100f100>] ? default_idle+0x20/0xb0
>>  [<ffffffff8100e74f>] arch_cpu_idle+0xf/0x20
>>  [<ffffffff810986a9>] cpuidle_idle_call+0x89/0x220
>>  [<ffffffff81078232>] ? __atomic_notifier_call_chain+0x12/0x20
>>  [<ffffffff81098975>] cpu_idle_loop+0x135/0x1f0
>>  [<ffffffff81098a43>] cpu_startup_entry+0x13/0x20
>>  [<ffffffff815c5e1c>] rest_init+0x7c/0x80
>>  [<ffffffff81b4e372>] start_kernel+0x3d8/0x3df
>>  [<ffffffff81b4ddb8>] ? set_init_arg+0x5d/0x5d
>>  [<ffffffff815cb906>] ? memblock_reserve+0x4c/0x51
>>  [<ffffffff81b4d5ad>] x86_64_start_reservations+0x2a/0x2c
>>  [<ffffffff81b4d6e4>] x86_64_start_kernel+0x135/0x13c
>> Code: 00 48 89 45 c8 45 89 c8 41 83 e0 3f 44 89 c6 0f 1f 40 00 48 63
>> ce 48 c1 e1 04 48 8b 04 39 48 8d 0c 0f 48 39 c8 74 22 0f 1f 40 00 <f6>
>> 40 18 01 75 10 48 8b 50 10 48 39 da 48 0f 48 da ba 01 00 00
>> RIP  [<ffffffff810bbc88>] get_next_timer_interrupt+0x158/0x230
>>  RSP <ffff88011fc03e48>
>> CR2: 0000000000000018
> --
> Jan Kara <jack@suse.cz>
> SUSE Labs, CR

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [v14 3/4] ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
  2015-04-29 11:45                 ` Li Xi
@ 2015-04-29 22:07                   ` Dave Chinner
  2015-06-04 15:29                     ` Li Xi
  0 siblings, 1 reply; 16+ messages in thread
From: Dave Chinner @ 2015-04-29 22:07 UTC (permalink / raw)
  To: Li Xi
  Cc: Jan Kara, linux-fsdevel, Ext4 Developers List, Theodore Ts'o,
	Andreas Dilger, viro, hch, Dmitry Monakhov, John Stultz,
	Thomas Gleixner

On Wed, Apr 29, 2015 at 07:45:40PM +0800, Li Xi wrote:
> On Wed, Apr 29, 2015 at 3:59 PM, Jan Kara <jack@suse.cz> wrote:
> >   Hi,
> >
> > On Wed 29-04-15 13:49:08, Li Xi wrote:
> >> Thanks for the advices. I tried to run latest xfstests again. However,
> >   Dave actually asked you to update 'xfsprogs' not xfstests. Not that
> > updating xfstests would be a wrong thing to do but you still need to update
> > xfsprogs for xfstests to be able to run some tests. But that's unrelated to
> > the oops you reported below.
> Understood. I updated both xfstests and xfsprogs to the latest version from git
> repository. However, I didn't update xfsdump because of a build failure caused
> by missing definitons of 'min' and 'max'

The /usr/include/xfs header files are stale. Upgrade your
xfslibs-dev package, if there is one for your distro.

And, please, report package build failures to the appropriate list,
next time, rather than ignoring them?

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [v14 3/4] ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
  2015-04-29 22:07                   ` Dave Chinner
@ 2015-06-04 15:29                     ` Li Xi
  2015-06-05  7:45                       ` Dmitry Monakhov
  0 siblings, 1 reply; 16+ messages in thread
From: Li Xi @ 2015-06-04 15:29 UTC (permalink / raw)
  To: Dave Chinner
  Cc: Jan Kara, linux-fsdevel, Ext4 Developers List, Theodore Ts'o,
	Andreas Dilger, viro, hch, Dmitry Monakhov, John Stultz,
	Thomas Gleixner

Hi,

I tried hard to run xfstests on original linux-4.0. In order to do so,
I skipped some of the tests which cause kernel crash. However, about
ten tests were skipped. But the crash seems endless. I was using the
latest xfstests from git repository. I guess there is some mismatch
between the versions of XFS and xfstests that I used? Should I use
some special version of xfstests or XFS? Please advise.

Regards,
Li Xi

On Thu, Apr 30, 2015 at 6:07 AM, Dave Chinner <david@fromorbit.com> wrote:
> On Wed, Apr 29, 2015 at 07:45:40PM +0800, Li Xi wrote:
>> On Wed, Apr 29, 2015 at 3:59 PM, Jan Kara <jack@suse.cz> wrote:
>> >   Hi,
>> >
>> > On Wed 29-04-15 13:49:08, Li Xi wrote:
>> >> Thanks for the advices. I tried to run latest xfstests again. However,
>> >   Dave actually asked you to update 'xfsprogs' not xfstests. Not that
>> > updating xfstests would be a wrong thing to do but you still need to update
>> > xfsprogs for xfstests to be able to run some tests. But that's unrelated to
>> > the oops you reported below.
>> Understood. I updated both xfstests and xfsprogs to the latest version from git
>> repository. However, I didn't update xfsdump because of a build failure caused
>> by missing definitons of 'min' and 'max'
>
> The /usr/include/xfs header files are stale. Upgrade your
> xfslibs-dev package, if there is one for your distro.
>
> And, please, report package build failures to the appropriate list,
> next time, rather than ignoring them?
>
> Cheers,
>
> Dave.
> --
> Dave Chinner
> david@fromorbit.com

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [v14 3/4] ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
  2015-06-04 15:29                     ` Li Xi
@ 2015-06-05  7:45                       ` Dmitry Monakhov
  0 siblings, 0 replies; 16+ messages in thread
From: Dmitry Monakhov @ 2015-06-05  7:45 UTC (permalink / raw)
  To: Li Xi, Dave Chinner
  Cc: Jan Kara, linux-fsdevel, Ext4 Developers List, Theodore Ts'o,
	Andreas Dilger, viro, hch, John Stultz, Thomas Gleixner

[-- Attachment #1: Type: text/plain, Size: 2075 bytes --]

Li Xi <pkuelelixi@gmail.com> writes:

> Hi,
>
> I tried hard to run xfstests on original linux-4.0. In order to do so,
> I skipped some of the tests which cause kernel crash. However, about
> ten tests were skipped. But the crash seems endless. I was using the
> latest xfstests from git repository. I guess there is some mismatch
> between the versions of XFS and xfstests that I used? Should I use
> some special version of xfstests or XFS? Please advise.
IMHO, the best version of the test is the one which cause a kernel crash.
So your have got the best one. But as far as Jan already mentioned this
is likely core mm/timer issue, not XFS specific one.
Google points me that code affected was changed here https://lkml.org/lkml/2015/3/26/14
Likely that you can trigger the crush w/o your patches. Is it correct?
You can try to fix original bug, or simply migrate patches to some
recent stable kernel version.

>
> Regards,
> Li Xi
>
> On Thu, Apr 30, 2015 at 6:07 AM, Dave Chinner <david@fromorbit.com> wrote:
>> On Wed, Apr 29, 2015 at 07:45:40PM +0800, Li Xi wrote:
>>> On Wed, Apr 29, 2015 at 3:59 PM, Jan Kara <jack@suse.cz> wrote:
>>> >   Hi,
>>> >
>>> > On Wed 29-04-15 13:49:08, Li Xi wrote:
>>> >> Thanks for the advices. I tried to run latest xfstests again. However,
>>> >   Dave actually asked you to update 'xfsprogs' not xfstests. Not that
>>> > updating xfstests would be a wrong thing to do but you still need to update
>>> > xfsprogs for xfstests to be able to run some tests. But that's unrelated to
>>> > the oops you reported below.
>>> Understood. I updated both xfstests and xfsprogs to the latest version from git
>>> repository. However, I didn't update xfsdump because of a build failure caused
>>> by missing definitons of 'min' and 'max'
>>
>> The /usr/include/xfs header files are stale. Upgrade your
>> xfslibs-dev package, if there is one for your distro.
>>
>> And, please, report package build failures to the appropriate list,
>> next time, rather than ignoring them?
>>
>> Cheers,
>>
>> Dave.
>> --
>> Dave Chinner
>> david@fromorbit.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-06-05  7:48 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-22 18:56 [v14 0/4] ext4: add project quota support Li Xi
2015-04-22 18:56 ` [v14 2/4] ext4: adds " Li Xi
2015-04-22 18:56 ` [v14 3/4] ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support Li Xi
2015-04-24 16:40   ` Jan Kara
     [not found]   ` <1429728997-21464-4-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
2015-04-26 23:20     ` Dave Chinner
2015-04-28  2:01       ` Li Xi
     [not found]         ` <CAPTn0cAHOHP060cW8k0-HnyfKdVaUwAVOyLZU43AXtECK6_EaA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-28  4:43           ` Dave Chinner
2015-04-29  5:49             ` Li Xi
2015-04-29  7:59               ` Jan Kara
2015-04-29 11:45                 ` Li Xi
2015-04-29 22:07                   ` Dave Chinner
2015-06-04 15:29                     ` Li Xi
2015-06-05  7:45                       ` Dmitry Monakhov
     [not found] ` <1429728997-21464-1-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
2015-04-22 18:56   ` [v14 1/4] ext4: adds project ID support Li Xi
2015-04-22 18:56   ` [v14 4/4] ext4: cleanup inode flag definitions Li Xi
2015-04-22 19:45   ` [v14 0/4] ext4: add project quota support Andreas Dilger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).