Skip to contentSkip to conversation

Print when ENOSPC due to lack of inodes in non-inode64 mount.

PATCH Superseded [email protected] 3 participants 11 messages Sep 11, 2012 – Sep 26, 2012 XFS filesystem

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Print when ENOSPC due to lack of inodes in non-inode64 mount.

From: Raghavendra D Prabhu <[email protected]>

Currently, when there are no free inodes left / free space to allocate them (usually without inode64), there is no indication anywhere of this case, making it harder to diagnose this case.

Hence, this series prints the causes/reasons to kernel log in a ratelimited manner, when such a situation arises.

-----
Version 1: Initially sent with pr_err_once to print the error only once.

Version 2: Added ratelimited functions to xfs_message.h instead of printing once with pr_err_once on suggestion of Dave Chinner.

Raghavendra D Prabhu (3):
Add ratelimited printk for different alert levels
XFS: Print error when xfs_ialloc_ag_select fails to find continuous
free space.
XFS: Print error when unable to allocate inodes or out of free
inodes.

 fs/xfs/xfs_ialloc.c  | 24 +++++++++++++++++++-----
 fs/xfs/xfs_message.h | 28 ++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 5 deletions(-)
Signature · 6 lines
1.7.12

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

PATCH v2 1/3 Add ratelimited printk for different alert levels

From: Raghavendra D Prabhu <[email protected]>

Ratelimited printk will be useful in printing xfs messages which are otherwise not required to be printed always due to their high rate (to prevent kernel ring buffer from overflowing), while at the same time required to be printed.

---
 fs/xfs/xfs_message.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
fs/xfs/xfs_message.h +28 -0
index 56dc0c1..87999a5 100644
@@ -1,6 +1,8 @@
 #ifndef __XFS_MESSAGE_H
 #define __XFS_MESSAGE_H 1
 
+#include <linux/ratelimit.h>
+
 struct xfs_mount;
 
 extern __printf(2, 3)
@@ -30,6 +32,32 @@ void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
 }
 #endif
 
+#define xfs_printk_ratelimited(xfs_printk, dev, fmt, ...)		\
+do {									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+	if (__ratelimit(&_rs))						\
+		xfs_printk(dev, fmt, ##__VA_ARGS__);			\
+} while (0)
+
+#define xfs_emerg_ratelimited(dev, fmt, ...)				\
+	xfs_printk_ratelimited(xfs_emerg, dev, fmt, ##__VA_ARGS__)
+#define xfs_alert_ratelimited(dev, fmt, ...)				\
+	xfs_printk_ratelimited(xfs_alert, dev, fmt, ##__VA_ARGS__)
+#define xfs_crit_ratelimited(dev, fmt, ...)				\
+	xfs_printk_ratelimited(xfs_crit, dev, fmt, ##__VA_ARGS__)
+#define xfs_err_ratelimited(dev, fmt, ...)				\
+	xfs_printk_ratelimited(xfs_err, dev, fmt, ##__VA_ARGS__)
+#define xfs_warn_ratelimited(dev, fmt, ...)				\
+	xfs_printk_ratelimited(xfs_warn, dev, fmt, ##__VA_ARGS__)
+#define xfs_notice_ratelimited(dev, fmt, ...)				\
+	xfs_printk_ratelimited(xfs_notice, dev, fmt, ##__VA_ARGS__)
+#define xfs_info_ratelimited(dev, fmt, ...)				\
+	xfs_printk_ratelimited(xfs_info, dev, fmt, ##__VA_ARGS__)
+#define xfs_dbg_ratelimited(dev, fmt, ...)				\
+	xfs_printk_ratelimited(xfs_dbg, dev, fmt, ##__VA_ARGS__)
+
 extern void assfail(char *expr, char *f, int l);
 
 extern void xfs_hex_dump(void *p, int length);
Signature · 6 lines
1.7.12

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

Re: [PATCH 1/3] Add ratelimited printk for different alert levels

Quoted 16 lines · On Wed, Sep 12, 2012 at 03:43:22AM +0530, [email protected] wrote:

From: Raghavendra D Prabhu <[email protected]>

Ratelimited printk will be useful in printing xfs messages which are otherwise not required to be printed always due to their high rate (to prevent kernel ring buffer from overflowing), while at the same time required to be printed.

---
 fs/xfs/xfs_message.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
fs/xfs/xfs_message.h +0 -0
index 56dc0c1..87999a5 100644

fs/xfs/xfs_message.h line 5

Quoted 5 lines
fs/xfs/xfs_message.h +2 -0
@@ -1,6 +1,8 @@
 #ifndef __XFS_MESSAGE_H
 #define __XFS_MESSAGE_H 1
 
+#include <linux/ratelimit.h>
+

Include this in xfs_linux.h rather than here.

Quoted 5 lines
fs/xfs/xfs_message.h +0 -0
 struct xfs_mount;
 
 extern __printf(2, 3)
@@ -30,6 +32,32 @@ void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
 }

fs/xfs/xfs_message.h void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...) · line 42

Quoted 10 lines
fs/xfs/xfs_message.h +8 -0
 #endif
 
+#define xfs_printk_ratelimited(xfs_printk, dev, fmt, ...)		\
+do {									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+	if (__ratelimit(&_rs))						\
+		xfs_printk(dev, fmt, ##__VA_ARGS__);			\
+} while (0)

Use "func" not xfs_printk here. xfs_printk looks too much like a real function name (indeed, we already have __xfs_printk) rather than a macro parameter.

Quoted 6 lines
fs/xfs/xfs_message.h +6 -0
+#define xfs_emerg_ratelimited(dev, fmt, ...)				\
+	xfs_printk_ratelimited(xfs_emerg, dev, fmt, ##__VA_ARGS__)
+#define xfs_alert_ratelimited(dev, fmt, ...)				\
+	xfs_printk_ratelimited(xfs_alert, dev, fmt, ##__VA_ARGS__)
+#define xfs_crit_ratelimited(dev, fmt, ...)				\
+	xfs_printk_ratelimited(xfs_crit, dev, fmt, ##__VA_ARGS__)

fs/xfs/xfs_message.h void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...) · line 59

Quoted 10 lines
fs/xfs/xfs_message.h +10 -0
+#define xfs_err_ratelimited(dev, fmt, ...)				\
+	xfs_printk_ratelimited(xfs_err, dev, fmt, ##__VA_ARGS__)
+#define xfs_warn_ratelimited(dev, fmt, ...)				\
+	xfs_printk_ratelimited(xfs_warn, dev, fmt, ##__VA_ARGS__)
+#define xfs_notice_ratelimited(dev, fmt, ...)				\
+	xfs_printk_ratelimited(xfs_notice, dev, fmt, ##__VA_ARGS__)
+#define xfs_info_ratelimited(dev, fmt, ...)				\
+	xfs_printk_ratelimited(xfs_info, dev, fmt, ##__VA_ARGS__)
+#define xfs_dbg_ratelimited(dev, fmt, ...)				\
+	xfs_printk_ratelimited(xfs_dbg, dev, fmt, ##__VA_ARGS__)

Here's the problem with adding macros that aren't used. xfs_dbg does not exist - the function is xfs_debug(). The compiler won't catch that until the macro is used, so only add the macros which are needed for this patch series.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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

Re: [PATCH 1/3] Add ratelimited printk for different alert levels

In reply to [email protected]
Quoted 3 lines · On Wed, 2012-09-12 at 03:43 +0530, [email protected] wrote:

Ratelimited printk will be useful in printing xfs messages which are otherwise not required to be printed always due to their high rate (to prevent kernel ring buffer from overflowing), while at the same time required to be printed.

[]

fs/xfs/xfs_message.h

Quoted 1 line
fs/xfs/xfs_message.h +0 -0

[]

fs/xfs/xfs_message.h void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...) · line 42

Quoted 12 lines
fs/xfs/xfs_message.h +8 -0
@@ -30,6 +32,32 @@ void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
 }
 #endif
 
+#define xfs_printk_ratelimited(xfs_printk, dev, fmt, ...)		\
+do {									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+	if (__ratelimit(&_rs))						\
+		xfs_printk(dev, fmt, ##__VA_ARGS__);			\
+} while (0)

It might be better to use an xfs singleton RATELIMIT_STATE

DEFINE_RATELIMIT_STATE(xfs_rs);
...
#define xfs_printk_ratelimited(xfs_printk, dev, fmt, ...) \

do {									\
	if (__ratelimit(&xfs_rs))					\
		xfs_printk(dev, fmt, ##__VA_ARGS__);			\
} while (0)

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

#4 lore raw

Re: [PATCH 1/3] Add ratelimited printk for different alert levels

Quoted 22 lines · Joe Perches
Quoted 3 lines · On Wed, 2012-09-12 at 03:43 +0530, [email protected] wrote:

Ratelimited printk will be useful in printing xfs messages which are otherwise not required to be printed always due to their high rate (to prevent kernel ring buffer from overflowing), while at the same time required to be printed.

[]

fs/xfs/xfs_message.h

Quoted 1 line
fs/xfs/xfs_message.h +0 -0

[]

fs/xfs/xfs_message.h void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...) · line 42

Quoted 12 lines
fs/xfs/xfs_message.h +8 -0
@@ -30,6 +32,32 @@ void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
 }
 #endif
 
+#define xfs_printk_ratelimited(xfs_printk, dev, fmt, ...)		\
+do {									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+	if (__ratelimit(&_rs))						\
+		xfs_printk(dev, fmt, ##__VA_ARGS__);			\
+} while (0)

It might be better to use an xfs singleton RATELIMIT_STATE

Quoted 7 lines

DEFINE_RATELIMIT_STATE(xfs_rs);
...
#define xfs_printk_ratelimited(xfs_printk, dev, fmt, ...) \

do {									\
	if (__ratelimit(&xfs_rs))					\
		xfs_printk(dev, fmt, ##__VA_ARGS__);			\
} while (0)

Which would then result in ratelimiting dropping potentially important, unique messages. I think it's much better to guarantee ratelimited messages get emitted at least once, especially as there is the potential for multiple filesystems to emit messages simultaneously.

I think per-location rate limiting is fine for the current usage - ratelimiting is not widespread so there isn't a massive increase in size as a result of this. If we do start to use ratelimiting in lots of places in XFS, then we might have to revisit this, but it's OK for now.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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

PATCH v2 2/3 XFS: Print error when xfs_ialloc_ag_select fails to find continuous free space.

In reply to [email protected]

From: Raghavendra D Prabhu <[email protected]>

When xfs_ialloc_ag_select fails to find any AG with continuous free blocks required for inode allocation, printk the error in ratelimited manner.

---
 fs/xfs/xfs_ialloc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/xfs/xfs_ialloc.c +4 -1
index 5aceb3f..e75a39d 100644
@@ -539,8 +539,11 @@ nextag:
 		if (agno >= agcount)
 			agno = 0;
 		if (agno == pagno) {
-			if (flags == 0)
+			if (flags == 0) {
+				xfs_err_ratelimited(mp,
+					"Out of continuous free blocks for inode allocation");
 				return NULLAGNUMBER;
+			}
 			flags = 0;
 		}
 	}
Signature · 6 lines
1.7.12

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

Re: [PATCH 2/3] XFS: Print error when xfs_ialloc_ag_select fails to find continuous free space.

Quoted 15 lines · On Wed, Sep 12, 2012 at 03:43:23AM +0530, [email protected] wrote:

From: Raghavendra D Prabhu <[email protected]>

When xfs_ialloc_ag_select fails to find any AG with continuous free blocks required for inode allocation, printk the error in ratelimited manner.

---
 fs/xfs/xfs_ialloc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/xfs/xfs_ialloc.c +0 -0
index 5aceb3f..e75a39d 100644

fs/xfs/xfs_ialloc.c nextag: · line 544

Quoted 7 lines
fs/xfs/xfs_ialloc.c +3 -1
@@ -539,8 +539,11 @@ nextag:
 		if (agno >= agcount)
 			agno = 0;
 		if (agno == pagno) {
-			if (flags == 0)
+			if (flags == 0) {
+				xfs_err_ratelimited(mp,
+					"Out of continuous free blocks for inode allocation");

http://oss.sgi.com/archives/xfs/2012-06/msg00041.html

<quote>
Couple of things for all 3 patches. Firstly - 80 columns. We tend to keep the pformat string on a single line so it is easy to grep for like so:

				pr_err_once(mp,
		"Insufficient contiguous free space for inode allocation");

</quote>

So, you need to change the error message to the one suggested, and follow 80-character width limits like the rest of the code.

Also, I think the error message is better at the caller site, not in the function itself. i.e. if we get a NULLAGNUMBER returned, the caller decided whether to emit an error message or not.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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

PATCH v2 3/3 XFS: Print error when unable to allocate inodes or out of free inodes.

In reply to [email protected]

From: Raghavendra D Prabhu <[email protected]>

When xfs_dialloc is unable to allocate required number of inodes or there are no AGs with free inodes, printk the error in ratelimited manner.

---
 fs/xfs/xfs_ialloc.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
fs/xfs/xfs_ialloc.c +15 -4
index e75a39d..034131b 100644
@@ -990,8 +990,11 @@ xfs_dialloc(
 				goto out_error;
 
 			xfs_perag_put(pag);
-			*inop = NULLFSINO;
-			return 0;
+
+			xfs_err_ratelimited(mp,
+				"Unable to allocate inodes in AG %d: Required %d, Current %llu, Maximum %llu",
+				agno, XFS_IALLOC_INODES(mp), mp->m_sb.sb_icount, mp->m_maxicount);
+			goto out_spc;
 		}
 
 		if (ialloced) {
@@ -1016,11 +1019,19 @@ nextag:
 		if (++agno == mp->m_sb.sb_agcount)
 			agno = 0;
 		if (agno == start_agno) {
-			*inop = NULLFSINO;
-			return noroom ? ENOSPC : 0;
+			if (noroom) {
+				xfs_err_ratelimited(mp,
+					"Out of AGs with free inodes: Required %d, Current %llu, Maximum %llu",
+					 XFS_IALLOC_INODES(mp), mp->m_sb.sb_icount, mp->m_maxicount);
+				goto out_spc;
+			}
+			return 0;
 		}
 	}
 
+out_spc:
+	*inop = NULLFSINO;
+	return ENOSPC;
 out_alloc:
 	*IO_agbp = NULL;
 	return xfs_dialloc_ag(tp, agbp, parent, inop);
Signature · 6 lines
1.7.12

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

Re: [PATCH 3/3] XFS: Print error when unable to allocate inodes or out of free inodes.

Quoted 15 lines · On Wed, Sep 12, 2012 at 03:43:24AM +0530, [email protected] wrote:

From: Raghavendra D Prabhu <[email protected]>

When xfs_dialloc is unable to allocate required number of inodes or there are no AGs with free inodes, printk the error in ratelimited manner.

---
 fs/xfs/xfs_ialloc.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
fs/xfs/xfs_ialloc.c +0 -0
index e75a39d..034131b 100644

fs/xfs/xfs_ialloc.c xfs_dialloc( · line 997

Quoted 10 lines
fs/xfs/xfs_ialloc.c +5 -2
@@ -990,8 +990,11 @@ xfs_dialloc(
 				goto out_error;
 
 			xfs_perag_put(pag);
-			*inop = NULLFSINO;
-			return 0;
+
+			xfs_err_ratelimited(mp,
+				"Unable to allocate inodes in AG %d: Required %d, Current %llu, Maximum %llu",
+				agno, XFS_IALLOC_INODES(mp), mp->m_sb.sb_icount, mp->m_maxicount);
+			goto out_spc;

This changes the error to be returned from 0 to ENOSPC. Adding error messages shouldn't change the logic of the code.

Also, you might want tolook at how ENOSPC is returned from xfs_ialloc_ag_alloc(). it only occurs when:

	if (mp->m_maxicount &&
            mp->m_sb.sb_icount + newlen > mp->m_maxicount) {

i.e. it is exactly the same error case as the "noroom" error below. It has nothing to do with being unable to allocate inodes in the specific AG - the global inode count is too high. IOWs, the error message is not correct.

Also, 80 columns.

fs/xfs/xfs_ialloc.c nextag: · line 1025

Quoted 13 lines
fs/xfs/xfs_ialloc.c +4 -2
 		}
 
 		if (ialloced) {
@@ -1016,11 +1019,19 @@ nextag:
 		if (++agno == mp->m_sb.sb_agcount)
 			agno = 0;
 		if (agno == start_agno) {
-			*inop = NULLFSINO;
-			return noroom ? ENOSPC : 0;
+			if (noroom) {
+				xfs_err_ratelimited(mp,
+					"Out of AGs with free inodes: Required %d, Current %llu, Maximum %llu",
+					 XFS_IALLOC_INODES(mp), mp->m_sb.sb_icount, mp->m_maxicount);

The error message here is misleading - the error is that we've exceeded the maximum inode count for the filesystem (same as the above error message case), so no further allocations are allowed.

What about the !noroom case? Isn't that a real ENOSPC condition? i.e. we've tried to allocate inodes in every AG and yet we've failed in all of them because there is no aligned, contiguous free space in any of the AGs. Shouldn't that emit an appropriate warning?

fs/xfs/xfs_ialloc.c nextag: · line 1037

Quoted 12 lines
fs/xfs/xfs_ialloc.c +6 -0
+				goto out_spc;
+			}
+			return 0;
 		}
 	}
 
+out_spc:
+	*inop = NULLFSINO;
+	return ENOSPC;
 out_alloc:
 	*IO_agbp = NULL;
 	return xfs_dialloc_ag(tp, agbp, parent, inop);

Default behaviour on a loop break is to allocate inodes, not return ENOSPC.

BTW, there's no need to cc LKML for XFS specific patches. LKML is noisy enough as it is without unnecessary cross-posts....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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

Re: Re: [PATCH 3/3] XFS: Print error when unable to allocate inodes or out of free inodes.

Hi,

Quoted 18 lines · * On Wed, Sep 12, 2012 at 09:21:44AM +1000, Dave Chinner <[email protected]>…
Quoted 17 lines · On Wed, Sep 12, 2012 at 03:43:24AM +0530, [email protected] wrote:

From: Raghavendra D Prabhu <[email protected]>

When xfs_dialloc is unable to allocate required number of inodes or there are no AGs with free inodes, printk the error in ratelimited manner.

---
 fs/xfs/xfs_ialloc.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
fs/xfs/xfs_ialloc.c +0 -0
index e75a39d..034131b 100644
@@ -990,8 +990,11 @@ xfs_dialloc(
 				goto out_error;
 
Quoted 11 lines

fs/xfs/xfs_ialloc.c xfs_dialloc( · line 997

Quoted 8 lines
fs/xfs/xfs_ialloc.c +5 -2
 			xfs_perag_put(pag);
-			*inop = NULLFSINO;
-			return 0;
+
+			xfs_err_ratelimited(mp,
+				"Unable to allocate inodes in AG %d: Required %d, Current %llu, Maximum %llu",
+				agno, XFS_IALLOC_INODES(mp), mp->m_sb.sb_icount, mp->m_maxicount);
+			goto out_spc;

This changes the error to be returned from 0 to ENOSPC. Adding error messages shouldn't change the logic of the code.

1) Yes, there is a confusion regarding that.

Quoted 11 lines

Also, you might want tolook at how ENOSPC is returned from xfs_ialloc_ag_alloc(). it only occurs when:

	if (mp->m_maxicount &&
           mp->m_sb.sb_icount + newlen > mp->m_maxicount) {

i.e. it is exactly the same error case as the "noroom" error below. It has nothing to do with being unable to allocate inodes in the specific AG - the global inode count is too high. IOWs, the error message is not correct.

Now, in xfs_dialloc

	if (mp->m_maxicount &&
	    mp->m_sb.sb_icount + XFS_IALLOC_INODES(mp) > mp->m_maxicount) {
		noroom = 1;
		okalloc = 0;
	}

why does it not make sense to bail out with ENOSPC then itself? I mean, what is the point of the loop when there is no room (noroom=1) and no allocations are allowed (okalloc = 0), also since the xfs_ialloc_ag_alloc in the loop uses same global logic to return.

Quoted 21 lines

Also, 80 columns.

fs/xfs/xfs_ialloc.c nextag: · line 1025

Quoted 13 lines
fs/xfs/xfs_ialloc.c +4 -2
 		}
 
 		if (ialloced) {
@@ -1016,11 +1019,19 @@ nextag:
 		if (++agno == mp->m_sb.sb_agcount)
 			agno = 0;
 		if (agno == start_agno) {
-			*inop = NULLFSINO;
-			return noroom ? ENOSPC : 0;
+			if (noroom) {
+				xfs_err_ratelimited(mp,
+					"Out of AGs with free inodes: Required %d, Current %llu, Maximum %llu",
+					 XFS_IALLOC_INODES(mp), mp->m_sb.sb_icount, mp->m_maxicount);

The error message here is misleading - the error is that we've exceeded the maximum inode count for the filesystem (same as the above error message case), so no further allocations are allowed.

Quoted 4 lines

What about the !noroom case? Isn't that a real ENOSPC condition? i.e. we've tried to allocate inodes in every AG and yet we've failed in all of them because there is no aligned, contiguous free space in any of the AGs. Shouldn't that emit an appropriate warning?

The warning is already emitted in call to xfs_ialloc_ag_select.

Now, what does inop = NULLFSINO, noroom = 0 and return value of 0 mean,

from the call chain of xfs_dir_ialloc -> xfs_ialloc -> xfs_dialloc

I see that, it is a true ENOSPC only if both the buffer pointed by ialloc_context and the inode are NULL or there is an error returned, in former case (noroom=0) xfs_dir_ialloc retries the allocation (ie. when AGI buffer is non-NULL).

Now, in case of global inode exhaustion, it is hard error which can be fixed only by remounting with inode64 and nothing else will do, hence, I think ENOSPC must be returned as error instead of 0. (also in case of point #1 above)

So, are the assumptions made above correct?

Quoted 17 lines

fs/xfs/xfs_ialloc.c nextag: · line 1037

Quoted 13 lines
fs/xfs/xfs_ialloc.c +6 -0
+				goto out_spc;
+			}
+			return 0;
 		}
 	}
 
+out_spc:
+	*inop = NULLFSINO;
+	return ENOSPC;
 out_alloc:
 	*IO_agbp = NULL;
 	return xfs_dialloc_ag(tp, agbp, parent, inop);

Default behaviour on a loop break is to allocate inodes, not return ENOSPC.

Quoted 10 lines

BTW, there's no need to cc LKML for XFS specific patches. LKML is noisy enough as it is without unnecessary cross-posts....

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]

Regards,

Signature · 4 lines
Raghavendra Prabhu
GPG Id : 0xD72BE977
Fingerprint: B93F EBCB 8E05 7039 CD3C A4B8 A616 DCA1 D72B E977
www: wnohang.net

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

#10 lore raw

Re: Re: [PATCH 3/3] XFS: Print error when unable to allocate inodes or out of free inodes.

Hi,

Quoted 32 lines · Raghavendra D Prabhu

Hi,

Quoted 28 lines

fs/xfs/xfs_ialloc.c nextag: · line 1037

Quoted 13 lines
fs/xfs/xfs_ialloc.c +6 -0
+                               goto out_spc;
+                       }
+                       return 0;
                }
        }
 
+out_spc:
+       *inop = NULLFSINO;
+       return ENOSPC;
 out_alloc:
        *IO_agbp = NULL;
        return xfs_dialloc_ag(tp, agbp, parent, inop);

Default behaviour on a loop break is to allocate inodes, not return ENOSPC.

BTW, there's no need to cc LKML for XFS specific patches. LKML is noisy enough as it is without unnecessary cross-posts....

Cheers,

Dave.
--
Dave Chinner
[email protected]

Ignore the previous. Resending the patch with fixes mentioned.

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