Print when ENOSPC due to lack of inodes.
cover Print when ENOSPC due to lack of inodes.
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 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(-)
Signature · 6 lines
1.7.10.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/3 XFS: Print error when xfs_ialloc_ag_select fails to find continuous free space.
From: Raghavendra D Prabhu <[email protected]>
When xfs_ialloc_ag_select fails to find any AG with continuous free blocks for needed inode allocation, printk error about it once.
--- fs/xfs/xfs_ialloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/xfs/xfs_ialloc.c +4 -1
@@ -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 ; } }
Signature · 6 lines
1.7.10.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/3 XFS: Print error when unable to allocate inodes.
In reply to [email protected]From: Raghavendra D Prabhu <[email protected]>
When xfs_ialloc_ag_alloc is unable to allocate required number of inodes, printk error about it once.
--- fs/xfs/xfs_ialloc.c | 2 ++ 1 file changed, 2 insertions(+)
fs/xfs/xfs_ialloc.c +2 -0
@@ -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;
Signature · 6 lines
1.7.10.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/3 XFS: Print error when there are no free AGs.
In reply to [email protected]From: Raghavendra D Prabhu <[email protected]>
After looping through all the AGs and failing to find any with free inodes, printk once about lack of AGs with free inodes.
--- fs/xfs/xfs_ialloc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/xfs/xfs_ialloc.c +5 -1
@@ -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 ) {
Signature · 6 lines
1.7.10.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 1/3] XFS: Print error when xfs_ialloc_ag_select fails to find continuous free space.
In reply to [email protected]Quoted 15 lines · On Sun, Jun 03, 2012 at 04:42:47PM +0530, [email protected] wrote:
From: Raghavendra D Prabhu <[email protected]>
When
xfs_ialloc_ag_selectfails to find any AG with continuous free blocks for needed inode allocation, printk error about it once.Signed-off-by Raghavendra D Prabhu <[email protected]>--- fs/xfs/xfs_ialloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/xfs/xfs_ialloc.c +0
-0
fs/xfs/xfs_ialloc.c nextag: · line 548
Quoted 7 lines
fs/xfs/xfs_ialloc.c +3
-1@@ -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.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs