xfs
[Top] [All Lists]

[PATCH] Printk for ENOSPC due to lack of inodes

To: xfs@xxxxxxxxxxx
Subject: [PATCH] Printk for ENOSPC due to lack of inodes
From: Raghavendra D Prabhu <raghu.prabhu13@xxxxxxxxx>
Date: Mon, 27 Feb 2012 06:07:33 +0530
Authentication-results: mr.google.com; spf=pass (google.com: domain of raghu.prabhu13@xxxxxxxxx designates 10.68.130.233 as permitted sender) smtp.mail=raghu.prabhu13@xxxxxxxxx; dkim=pass header.i=raghu.prabhu13@xxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-type:content-disposition:x-operating-system:x-editor :user-agent; bh=UP5dbaaYEINoOD2bGzXK1fKcLGDuYk+lnJEaMZzy1Do=; b=dEuSdr5tRGi72apYofqdnFPEaxWriWRfegQwg2Z4DRE2KNUgJU/2m+lKG1zx6SUon6 mS9tbx67R18yZfuJ/qn1LEIlOnt5+Qh+VWcawKFq+KfCnpbJU73K481vGdnkjoWNSBas 9AB+dx16PHXBfxnHqozJZMg1unpPgkI580qvI=
Mail-followup-to: xfs@xxxxxxxxxxx
User-agent: Mutt/1.5.21 (2010-12-30)
Hi,

While diagnosing a MySQL crash (on a Centos 5.7 box), I noticed that it had failed with ENOSPC earlier; it was rebooted after that; now after reboot, even though space was there, ENOSPC was showing up, I also did df -i and it showed inodes available. At this point, mounting with inode64 option was tried, which fixed it. http://oss.sgi.com/archives/xfs/2011-03/msg00299.html helped me here.

So, I have attached a patch here.

=====================================================================


When a ENOSPC is encountered and it is due to lack of inodes (particularly
without inode64), it is not possible to detect this (df -i doesn't help here),
so adding a printk which can aid in detecting this.

Signed-off-by: Raghavendra D Prabhu <rprabhu@xxxxxxxxxxx>
---
 fs/xfs/xfs_qm.c       |    3 +++
 fs/xfs/xfs_vnodeops.c |   10 ++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index c872fea..fbefa87 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -987,6 +987,9 @@ xfs_qm_qino_alloc(
error = xfs_dir_ialloc(&tp, NULL, S_IFREG, 1, 0, 0, 1, ip, &committed);
        if (error) {
+               if (error == ENOSPC)
+                       xfs_err(mp, "Out of inodes: Required %d, Current %llu, 
Maximum %llu",
+                                       XFS_IALLOC_INODES(mp), mp->m_sb.sb_icount, 
mp->m_maxicount);
                xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES |
                                 XFS_TRANS_ABORT);
                return error;
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index ebdb888..7542c36 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -946,8 +946,11 @@ xfs_create(
        error = xfs_dir_ialloc(&tp, dp, mode, is_dir ? 2 : 1, rdev,
                               prid, resblks > 0, &ip, &committed);
        if (error) {
-               if (error == ENOSPC)
+               if (error == ENOSPC) {
+                       xfs_err(mp, "Out of inodes: Required %d, Current %llu, 
Maximum %llu",
+                                       XFS_IALLOC_INODES(mp), mp->m_sb.sb_icount, 
mp->m_maxicount);
                        goto out_trans_cancel;
+               }
                goto out_trans_abort;
        }
@@ -1610,8 +1613,11 @@ xfs_symlink(
        error = xfs_dir_ialloc(&tp, dp, S_IFLNK | (mode & ~S_IFMT), 1, 0,
                               prid, resblks > 0, &ip, NULL);
        if (error) {
-               if (error == ENOSPC)
+               if (error == ENOSPC) {
+                       xfs_err(mp, "Out of inodes: Required %d, Current %llu, 
Maximum %llu",
+                                       XFS_IALLOC_INODES(mp), mp->m_sb.sb_icount, 
mp->m_maxicount);
                        goto error_return;
+               }
                goto error1;
        }
--
1.7.9.2

Regards,
--
Raghavendra Prabhu
GPG Id : 0xD72BE977
Fingerprint: B93F EBCB 8E05 7039 CD3C A4B8 A616 DCA1 D72B E977
www: wnohang.net

Attachment: pgphMU8KYo0IA.pgp
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] Printk for ENOSPC due to lack of inodes, Raghavendra D Prabhu <=