Skip to contentSkip to conversation

xfs: fix assertion failure at xfs_setattr_nonsize

PATCH Superseded Jeff Liu 2 participants 5 messages Nov 22, 2013 XFS filesystem

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jeff Liu

author
#0 lore raw

PATCH 1/1 xfs: fix assertion failure at xfs_setattr_nonsize

From: Jie Liu <[email protected]>

For CRC enabled v5 super block, change a file's ownership can simply trigger ASSERT failure at xfs_setattr_nonsize() if both group and project quota are enabled, e.g,

[  305.337609] XFS: Assertion failed: !XFS_IS_PQUOTA_ON(mp), file: fs/xfs/xfs_iops.c, line: 621
[  305.339250] Kernel BUG at ffffffffa0a7fa32 [verbose debug info unavailable]
[  305.383939] Call Trace:
[  305.385536]  [<ffffffffa0a7d95a>] xfs_setattr_nonsize+0x69a/0x720 [xfs]
[  305.387142]  [<ffffffffa0a7dea9>] xfs_vn_setattr+0x29/0x70 [xfs]
[  305.388727]  [<ffffffff811ca388>] notify_change+0x1a8/0x350
[  305.390298]  [<ffffffff811ac39d>] chown_common+0xfd/0x110
[  305.391868]  [<ffffffff811ad6bf>] SyS_fchownat+0xaf/0x110
[  305.393440]  [<ffffffff811ad760>] SyS_lchown+0x20/0x30
[  305.394995]  [<ffffffff8170f7dd>] system_call_fastpath+0x1a/0x1f
[  305.399870] RIP  [<ffffffffa0a7fa32>] assfail+0x22/0x30 [xfs]

To remain the current semantics under the debug mode, this fix add an additional judgement to make this assertion only works for non-CRC enabled version.

---
 fs/xfs/xfs_iops.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/xfs/xfs_iops.c +4 -1
index 27e0e54..586f1f2 100644
@@ -618,7 +618,10 @@ xfs_setattr_nonsize(
 		}
 		if (!gid_eq(igid, gid)) {
 			if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_GQUOTA_ON(mp)) {
-				ASSERT(!XFS_IS_PQUOTA_ON(mp));
+#ifdef DEBUG
+				if (!xfs_sb_version_has_pquotino(&mp->m_sb))
+					ASSERT(!XFS_IS_PQUOTA_ON(mp));
+#endif
 				ASSERT(mask & ATTR_GID);
 				ASSERT(gdqp);
 				olddquot2 = xfs_qm_vop_chown(tp, ip,
Signature · 6 lines
1.7.9.5

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

fs/xfs/xfs_iops.c xfs_setattr_nonsize( · line 626

Quoted 13 lines · Jeff Liu

To remain the current semantics under the debug mode, this fix add an additional judgement to make this assertion only works for non-CRC enabled version.

fs/xfs/xfs_iops.c +4 -1
 		if (!gid_eq(igid, gid)) {
 			if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_GQUOTA_ON(mp)) {
-				ASSERT(!XFS_IS_PQUOTA_ON(mp));
+#ifdef DEBUG
+				if (!xfs_sb_version_has_pquotino(&mp->m_sb))
+					ASSERT(!XFS_IS_PQUOTA_ON(mp));
+#endif
 				ASSERT(mask & ATTR_GID);
 				ASSERT(gdqp);

I'd just kill this assert. And it would be good to get some coverage of running with all three quotas types into xfstests by default..

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

author
#2 lore raw
Quoted 5 lines · Christoph Hellwig
Quoted 3 lines · Jeff Liu

To remain the current semantics under the debug mode, this fix add an additional judgement to make this assertion only works for non-CRC enabled version.

Quoted 11 lines

fs/xfs/xfs_iops.c xfs_setattr_nonsize( · line 626

Quoted 9 lines
fs/xfs/xfs_iops.c +4 -1
 		if (!gid_eq(igid, gid)) {
 			if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_GQUOTA_ON(mp)) {
-				ASSERT(!XFS_IS_PQUOTA_ON(mp));
+#ifdef DEBUG quota
+				if (!xfs_sb_version_has_pquotino(&mp->m_sb))
+					ASSERT(!XFS_IS_PQUOTA_ON(mp));
+#endif
 				ASSERT(mask & ATTR_GID);
 				ASSERT(gdqp);

I'd just kill this assert.

I hesitated about killing this assertion or hold the line before, will fix it soon.

Quoted 2 lines

And it would be good to get some coverage
of running with all three quotas types into xfstests by default..

Definitely! I just found another race problem between dquot attach and quota off via fsstress as per Dave's suggestion for another fix. :)

Thanks,
-Jeff

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

#3 lore raw
Quoted 17 lines · Jeff Liu
Quoted 5 lines · Christoph Hellwig
Quoted 3 lines · Jeff Liu

To remain the current semantics under the debug mode, this fix add an additional judgement to make this assertion only works for non-CRC enabled version.

Quoted 11 lines

fs/xfs/xfs_iops.c xfs_setattr_nonsize( · line 626

Quoted 9 lines
fs/xfs/xfs_iops.c +4 -1
 		if (!gid_eq(igid, gid)) {
 			if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_GQUOTA_ON(mp)) {
-				ASSERT(!XFS_IS_PQUOTA_ON(mp));
+#ifdef DEBUG quota
+				if (!xfs_sb_version_has_pquotino(&mp->m_sb))
+					ASSERT(!XFS_IS_PQUOTA_ON(mp));
+#endif
 				ASSERT(mask & ATTR_GID);
 				ASSERT(gdqp);

I'd just kill this assert.

Quoted 1 line

I hesitated about killing this assertion or hold the line before, will fix it soon.

If we want to keep it maybe write is a little nicer:

	ASSERT(xfs_sb_version_has_pquotino(&mp->m_sb) ||
	       !XFS_IS_PQUOTA_ON(mp));

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

author
#4 lore raw
Quoted 18 lines · Christoph Hellwig
Quoted 17 lines · Jeff Liu
Quoted 16 lines · Christoph Hellwig

fs/xfs/xfs_iops.c xfs_setattr_nonsize( · line 626

Quoted 13 lines · Jeff Liu

To remain the current semantics under the debug mode, this fix add an additional judgement to make this assertion only works for non-CRC enabled version.

fs/xfs/xfs_iops.c +4 -1
 		if (!gid_eq(igid, gid)) {
 			if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_GQUOTA_ON(mp)) {
-				ASSERT(!XFS_IS_PQUOTA_ON(mp));
+#ifdef DEBUG quota
+				if (!xfs_sb_version_has_pquotino(&mp->m_sb))
+					ASSERT(!XFS_IS_PQUOTA_ON(mp));
+#endif
 				ASSERT(mask & ATTR_GID);
 				ASSERT(gdqp);

I'd just kill this assert.

Quoted 6 lines
Quoted 1 line

I hesitated about killing this assertion or hold the line before, will fix it soon.

If we want to keep it maybe write is a little nicer:

	ASSERT(xfs_sb_version_has_pquotino(&mp->m_sb) ||
	       !XFS_IS_PQUOTA_ON(mp));

Nice point! I'd take this suggestion.

Thanks,
-Jeff

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