* [PATCH 4/5] xfs: use fs netlink interface for ENOSPC conditions
[not found] <1313669906-14931-1-git-send-email-lczerner@redhat.com>
@ 2011-08-18 12:18 ` Lukas Czerner
2011-08-25 5:16 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Lukas Czerner @ 2011-08-18 12:18 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-fsdevel, Lukas Czerner, Christoph Hellwig, xfs
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
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 4/5] xfs: use fs netlink interface for ENOSPC conditions
2011-08-18 12:18 ` [PATCH 4/5] xfs: use fs netlink interface for ENOSPC conditions Lukas Czerner
@ 2011-08-25 5:16 ` Christoph Hellwig
2011-08-25 8:58 ` Lukas Czerner
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2011-08-25 5:16 UTC (permalink / raw)
To: Lukas Czerner; +Cc: linux-fsdevel, xfs, linux-kernel, Christoph Hellwig
> xfs_rw_iunlock(ip, iolock);
> + if (unlikely(-ENOSPC == ret))
> + fs_nl_send_warning(inode->i_sb->s_dev, FS_NL_ENOSPC_WARN);
I'd remove the nl from both the name and the constants. In the end what
matters is the warning, and netlink just is an implementation detail.
> 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();
Why do we have to call this from the filesystem? Shouldn't we
initialize it once from the VFS?
Also any chance you could include the quota netlink warnings into the
framework? Any callers is also going to be interestested in quota
warnings, not just enospc. Also the xfs project quota code returns
ENOSPC if over the project quota and needs to be handled either way.
Adding another new category inbetween user/group quotas and plain ENOSPC
for it would be nice.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 4/5] xfs: use fs netlink interface for ENOSPC conditions
2011-08-25 5:16 ` Christoph Hellwig
@ 2011-08-25 8:58 ` Lukas Czerner
0 siblings, 0 replies; 3+ messages in thread
From: Lukas Czerner @ 2011-08-25 8:58 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-fsdevel, Lukas Czerner, xfs, linux-kernel,
Christoph Hellwig
On Thu, 25 Aug 2011, Christoph Hellwig wrote:
> > xfs_rw_iunlock(ip, iolock);
> > + if (unlikely(-ENOSPC == ret))
> > + fs_nl_send_warning(inode->i_sb->s_dev, FS_NL_ENOSPC_WARN);
>
> I'd remove the nl from both the name and the constants. In the end what
> matters is the warning, and netlink just is an implementation detail.
That makes sense, I'll change that.
>
> > 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();
>
> Why do we have to call this from the filesystem? Shouldn't we
> initialize it once from the VFS?
That's probably better than initialization in every file system. It
would also mean that the interface will be initializes even if there is
no user of it on the kernel side, but that should not be a problem I
guess.
>
>
>
> Also any chance you could include the quota netlink warnings into the
> framework? Any callers is also going to be interestested in quota
> warnings, not just enospc. Also the xfs project quota code returns
> ENOSPC if over the project quota and needs to be handled either way.
> Adding another new category inbetween user/group quotas and plain ENOSPC
> for it would be nice.
That's the plan. I want to merge quota notification into this interface
as well (rather than having separate netlink interface
fs/quota/netlink.c). So, I'll try to do that in the next version of the
patches.
Thanks!
-Lukas
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-25 8:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1313669906-14931-1-git-send-email-lczerner@redhat.com>
2011-08-18 12:18 ` [PATCH 4/5] xfs: use fs netlink interface for ENOSPC conditions Lukas Czerner
2011-08-25 5:16 ` Christoph Hellwig
2011-08-25 8:58 ` Lukas Czerner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox