public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Print when ENOSPC due to lack of inodes.
@ 2012-06-03 11:12 raghu.prabhu13
  2012-06-03 11:12 ` [PATCH 1/3] XFS: Print error when xfs_ialloc_ag_select fails to find continuous free space raghu.prabhu13
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: raghu.prabhu13 @ 2012-06-03 11:12 UTC (permalink / raw)
  To: xfs; +Cc: Raghavendra D Prabhu, raghu.prabhu13

From: Raghavendra D Prabhu <rprabhu@wnohang.net>

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 three-part patch series to print errors to kernel log with reasons,
when such a situation arises.

Raghavendra D Prabhu (3):
  XFS: Print error when xfs_ialloc_ag_select fails to find continuous
    free space.
  XFS: Print error when unable to allocate inodes.
  XFS: Print error when there are no free AGs.

 fs/xfs/xfs_ialloc.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

-- 
1.7.10.3

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* [PATCH 1/3] XFS: Print error when xfs_ialloc_ag_select fails to find continuous free space.
  2012-06-03 11:12 [PATCH 0/3] Print when ENOSPC due to lack of inodes raghu.prabhu13
@ 2012-06-03 11:12 ` raghu.prabhu13
  2012-06-05 14:00   ` Dave Chinner
  2012-06-03 11:12 ` [PATCH 2/3] XFS: Print error when unable to allocate inodes raghu.prabhu13
  2012-06-03 11:12 ` [PATCH 3/3] XFS: Print error when there are no free AGs raghu.prabhu13
  2 siblings, 1 reply; 5+ messages in thread
From: raghu.prabhu13 @ 2012-06-03 11:12 UTC (permalink / raw)
  To: xfs; +Cc: Raghavendra D Prabhu, raghu.prabhu13

From: Raghavendra D Prabhu <rprabhu@wnohang.net>

When xfs_ialloc_ag_select fails to find any AG with continuous free blocks for
needed inode allocation, printk error about it once.

Signed-off-by: Raghavendra D Prabhu <rprabhu@wnohang.net>
---
 fs/xfs/xfs_ialloc.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index 177a21a..a02180a 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -543,8 +543,11 @@ nextag:
 		if (agno >= agcount)
 			agno = 0;
 		if (agno == pagno) {
-			if (flags == 0)
+			if (flags == 0) {
+				pr_err_once("XFS (%s): Out of continuous free blocks for inode allocation",
+						mp->m_fsname);
 				return NULL;
+			}
 			flags = 0;
 		}
 	}
-- 
1.7.10.3

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* [PATCH 2/3] XFS: Print error when unable to allocate inodes.
  2012-06-03 11:12 [PATCH 0/3] Print when ENOSPC due to lack of inodes raghu.prabhu13
  2012-06-03 11:12 ` [PATCH 1/3] XFS: Print error when xfs_ialloc_ag_select fails to find continuous free space raghu.prabhu13
@ 2012-06-03 11:12 ` raghu.prabhu13
  2012-06-03 11:12 ` [PATCH 3/3] XFS: Print error when there are no free AGs raghu.prabhu13
  2 siblings, 0 replies; 5+ messages in thread
From: raghu.prabhu13 @ 2012-06-03 11:12 UTC (permalink / raw)
  To: xfs; +Cc: Raghavendra D Prabhu, raghu.prabhu13

From: Raghavendra D Prabhu <rprabhu@wnohang.net>

When xfs_ialloc_ag_alloc is unable to allocate required number of inodes, printk
error about it once.

Signed-off-by: Raghavendra D Prabhu <rprabhu@wnohang.net>
---
 fs/xfs/xfs_ialloc.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index a02180a..343d7a8 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -744,6 +744,8 @@ xfs_dialloc(
 				xfs_trans_brelse(tp, agbp);
 				if (error == ENOSPC) {
 					*inop = NULLFSINO;
+					pr_err_once("XFS (%s): Unable to allocate inodes: Required %d, Current %llu, Maximum %llu",
+							mp->m_fsname, XFS_IALLOC_INODES(mp), mp->m_sb.sb_icount, mp->m_maxicount);
 					return 0;
 				} else
 					return error;
-- 
1.7.10.3

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* [PATCH 3/3] XFS: Print error when there are no free AGs.
  2012-06-03 11:12 [PATCH 0/3] Print when ENOSPC due to lack of inodes raghu.prabhu13
  2012-06-03 11:12 ` [PATCH 1/3] XFS: Print error when xfs_ialloc_ag_select fails to find continuous free space raghu.prabhu13
  2012-06-03 11:12 ` [PATCH 2/3] XFS: Print error when unable to allocate inodes raghu.prabhu13
@ 2012-06-03 11:12 ` raghu.prabhu13
  2 siblings, 0 replies; 5+ messages in thread
From: raghu.prabhu13 @ 2012-06-03 11:12 UTC (permalink / raw)
  To: xfs; +Cc: Raghavendra D Prabhu, raghu.prabhu13

From: Raghavendra D Prabhu <rprabhu@wnohang.net>

After looping through all the AGs and failing to find any with free inodes,
printk once about lack of AGs with free inodes.

Signed-off-by: Raghavendra D Prabhu <rprabhu@wnohang.net>
---
 fs/xfs/xfs_ialloc.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index 343d7a8..b24ffa3 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -776,7 +776,11 @@ nextag:
 			tagno = 0;
 		if (tagno == agno) {
 			*inop = NULLFSINO;
-			return noroom ? ENOSPC : 0;
+			if (noroom) {
+				pr_err_once("XFS (%s): Out of AGs with free inodes: Required %d, Current %llu, Maximum %llu",
+						mp->m_fsname, XFS_IALLOC_INODES(mp), mp->m_sb.sb_icount, mp->m_maxicount);
+				return 0;
+			}
 		}
 		pag = xfs_perag_get(mp, tagno);
 		if (pag->pagi_inodeok == 0) {
-- 
1.7.10.3

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH 1/3] XFS: Print error when xfs_ialloc_ag_select fails to find continuous free space.
  2012-06-03 11:12 ` [PATCH 1/3] XFS: Print error when xfs_ialloc_ag_select fails to find continuous free space raghu.prabhu13
@ 2012-06-05 14:00   ` Dave Chinner
  0 siblings, 0 replies; 5+ messages in thread
From: Dave Chinner @ 2012-06-05 14:00 UTC (permalink / raw)
  To: raghu.prabhu13; +Cc: Raghavendra D Prabhu, xfs

On Sun, Jun 03, 2012 at 04:42:47PM +0530, raghu.prabhu13@gmail.com wrote:
> From: Raghavendra D Prabhu <rprabhu@wnohang.net>
> 
> When xfs_ialloc_ag_select fails to find any AG with continuous free blocks for
> needed inode allocation, printk error about it once.
> 
> Signed-off-by: Raghavendra D Prabhu <rprabhu@wnohang.net>
> ---
>  fs/xfs/xfs_ialloc.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
> index 177a21a..a02180a 100644
> --- a/fs/xfs/xfs_ialloc.c
> +++ b/fs/xfs/xfs_ialloc.c
> @@ -543,8 +543,11 @@ nextag:
>  		if (agno >= agcount)
>  			agno = 0;
>  		if (agno == pagno) {
> -			if (flags == 0)
> +			if (flags == 0) {
> +				pr_err_once("XFS (%s): Out of continuous free blocks for inode allocation",
> +						mp->m_fsname);

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");

Secondly, I'm not sure "print once and once only" is the right
behaviour here.  This will only warn on one filesystem and only
once for the uptime of the system. So if you hit this 5 minutes
after boot, then clean up, you'll never get it emitted again even
when the condition reappears 6 months later. hence I think this
should be a rate-limited print, not a print once.

And finally, you should add a xfs_err_ratelimited wrapper, not not
use pr_err_ratelimited() directly and open code the identifier
prefixes.

i.e. something like:

#define xfs_printk_ratelimited(func, mp, fmt, ...)		\
({								\
	static DEFINE_RATELIMIT_STATE(_rs,			\
				DEFAULT_RATELIMIT_INTERVAL,	\
				DEFAULT_RATELIMIT_BURST);	\
								\
	if (__ratelimit(&_rs))					\
		(func)((mp), fmt, ##__VA_ARGS__);		\
})

#define xfs_err_once(mp, fmt, ...)			\
		xfs_printk_ratelimited(xfs_err, (mp), fmt, ##__VA_ARGS__); 

So we can easily extend it to other logging levels as needed.


Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

end of thread, other threads:[~2012-06-05 14:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-03 11:12 [PATCH 0/3] Print when ENOSPC due to lack of inodes raghu.prabhu13
2012-06-03 11:12 ` [PATCH 1/3] XFS: Print error when xfs_ialloc_ag_select fails to find continuous free space raghu.prabhu13
2012-06-05 14:00   ` Dave Chinner
2012-06-03 11:12 ` [PATCH 2/3] XFS: Print error when unable to allocate inodes raghu.prabhu13
2012-06-03 11:12 ` [PATCH 3/3] XFS: Print error when there are no free AGs raghu.prabhu13

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox