linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Czerner <lczerner@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org,
	Lukas Czerner <lczerner@redhat.com>,
	Christoph Hellwig <hch@lst.de>,
	xfs@oss.sgi.com
Subject: [PATCH 4/5] xfs: use fs netlink interface for ENOSPC conditions
Date: Thu, 18 Aug 2011 14:18:25 +0200	[thread overview]
Message-ID: <1313669906-14931-5-git-send-email-lczerner@redhat.com> (raw)
In-Reply-To: <1313669906-14931-1-git-send-email-lczerner@redhat.com>

Register fs netlink interface and send proper warning if ENOSPC is
encountered. Note that we differentiate between enospc for metadata and
enospc for data.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
CC: Christoph Hellwig <hch@lst.de>
CC: xfs@oss.sgi.com
---
 fs/xfs/linux-2.6/xfs_file.c  |    2 ++
 fs/xfs/linux-2.6/xfs_super.c |    1 +
 fs/xfs/xfs_vnodeops.c        |   10 ++++++++--
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 7f7b424..ab41603 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -896,6 +896,8 @@ xfs_file_aio_write(
 out_unlock:
 	xfs_aio_write_newsize_update(ip);
 	xfs_rw_iunlock(ip, iolock);
+	if (unlikely(-ENOSPC == ret))
+		fs_nl_send_warning(inode->i_sb->s_dev, FS_NL_ENOSPC_WARN);
 	return ret;
 }
 
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 9a72dda..dd167a0 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -1731,6 +1731,7 @@ init_xfs_fs(void)
 	error = register_filesystem(&xfs_fs_type);
 	if (error)
 		goto out_sysctl_unregister;
+	init_fs_nl_family();
 	return 0;
 
  out_sysctl_unregister:
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 51fc429..1a95115 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -996,6 +996,8 @@ xfs_create(
  out_trans_abort:
 	cancel_flags |= XFS_TRANS_ABORT;
  out_trans_cancel:
+	if (ENOSPC == error)
+		fs_nl_send_warning(mp->m_super->s_dev, FS_NL_META_ENOSPC_WARN);
 	xfs_trans_cancel(tp, cancel_flags);
  out_release_inode:
 	/*
@@ -2302,7 +2304,7 @@ xfs_change_file_space(
 		error = xfs_alloc_file_space(ip, startoffset, bf->l_len,
 						prealloc_type, attr_flags);
 		if (error)
-			return error;
+			goto alloc_failed;
 		setprealloc = 1;
 		break;
 
@@ -2321,7 +2323,7 @@ xfs_change_file_space(
 			error = xfs_alloc_file_space(ip, fsize,
 					startoffset - fsize, 0, attr_flags);
 			if (error)
-				break;
+				goto alloc_failed;
 		}
 
 		iattr.ia_valid = ATTR_SIZE;
@@ -2384,5 +2386,9 @@ xfs_change_file_space(
 
 	xfs_iunlock(ip, XFS_ILOCK_EXCL);
 
+alloc_failed:
+	if (unlikely(ENOSPC == error))
+		fs_nl_send_warning(mp->m_super->s_dev, FS_NL_ENOSPC_WARN);
+
 	return error;
 }
-- 
1.7.4.4

  parent reply	other threads:[~2011-08-18 12:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-18 12:18 [RFC][PATCH 0/5] Add netlink file system notification interface Lukas Czerner
2011-08-18 12:18 ` [PATCH 1/5] fs: add netlink " Lukas Czerner
2011-08-18 15:00   ` Randy Dunlap
2011-08-18 15:42     ` Lukas Czerner
2011-08-19 15:15   ` Ted Ts'o
2011-08-23  9:03     ` Lukas Czerner
2011-08-18 12:18 ` [PATCH 2/5] ext3: use fs netlink interface for ENOSPC conditions Lukas Czerner
2011-08-18 12:18 ` [PATCH 3/5] ext4: " Lukas Czerner
2011-08-18 12:18 ` Lukas Czerner [this message]
2011-08-25  5:16   ` [PATCH 4/5] xfs: " Christoph Hellwig
2011-08-25  8:58     ` Lukas Czerner
2011-08-18 12:18 ` [PATCH 5/5] btrfs: " Lukas Czerner
2011-08-18 18:22   ` David Sterba
2011-08-18 19:03     ` Lukas Czerner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1313669906-14931-5-git-send-email-lczerner@redhat.com \
    --to=lczerner@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).