* [PATCH 1/2] ext4: force block allocation on quota_off
@ 2010-05-28 11:27 Dmitry Monakhov
2010-05-28 11:27 ` [PATCH 2/2] quota: check quota reservation on remove_dquot_ref Dmitry Monakhov
2010-05-31 19:11 ` [PATCH 1/2] ext4: force block allocation on quota_off Jan Kara
0 siblings, 2 replies; 9+ messages in thread
From: Dmitry Monakhov @ 2010-05-28 11:27 UTC (permalink / raw)
To: linux-fsdevel, linux-ext4; +Cc: jack, Dmitry Monakhov
Perform full sync procedure to guarantee quota consistency.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/ext4/super.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index e5166e5..4e8a7b5 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1075,6 +1075,7 @@ static int ext4_mark_dquot_dirty(struct dquot *dquot);
static int ext4_write_info(struct super_block *sb, int type);
static int ext4_quota_on(struct super_block *sb, int type, int format_id,
char *path, int remount);
+static int ext4_quota_off(struct super_block *sb, int type, int remount);
static int ext4_quota_on_mount(struct super_block *sb, int type);
static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
size_t len, loff_t off);
@@ -1096,7 +1097,7 @@ static const struct dquot_operations ext4_quota_operations = {
static const struct quotactl_ops ext4_qctl_operations = {
.quota_on = ext4_quota_on,
- .quota_off = vfs_quota_off,
+ .quota_off = ext4_quota_off,
.quota_sync = vfs_quota_sync,
.get_info = vfs_get_dqinfo,
.set_info = vfs_set_dqinfo,
@@ -3986,6 +3987,18 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
return err;
}
+static int ext4_quota_off(struct super_block *sb, int type, int remount)
+{
+ /* Force all delayed allocation blocks to be allocated */
+ if (test_opt(sb, DELALLOC) && !remount) {
+ down_read(&sb->s_umount);
+ sync_filesystem(sb);
+ up_read(&sb->s_umount);
+ }
+
+ return vfs_quota_off(sb, type, remount);
+}
+
/* Read data from quotafile - avoid pagecache and such because we cannot afford
* acquiring the locks... As quota files are never truncated and quota code
* itself serializes the operations (and noone else should touch the files)
--
1.6.6.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] quota: check quota reservation on remove_dquot_ref
2010-05-28 11:27 [PATCH 1/2] ext4: force block allocation on quota_off Dmitry Monakhov
@ 2010-05-28 11:27 ` Dmitry Monakhov
2010-05-31 19:11 ` [PATCH 1/2] ext4: force block allocation on quota_off Jan Kara
1 sibling, 0 replies; 9+ messages in thread
From: Dmitry Monakhov @ 2010-05-28 11:27 UTC (permalink / raw)
To: linux-fsdevel, linux-ext4; +Cc: jack, Dmitry Monakhov
Reserved space must being claimed before remove_dquot_ref() for a
given inode. Filesystem is responsible for performing force blocks
allocation in case of dealloc in ->quota_off. Let's add sanity check
for that case. Do it similar to add_dquot_ref().
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/quota/dquot.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 99eefbb..f15fc9c 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -988,6 +988,7 @@ static void remove_dquot_ref(struct super_block *sb, int type,
struct list_head *tofree_head)
{
struct inode *inode;
+ int reserved = 0;
spin_lock(&inode_lock);
list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
@@ -997,10 +998,21 @@ static void remove_dquot_ref(struct super_block *sb, int type,
* only quota pointers and these have separate locking
* (dqptr_sem).
*/
- if (!IS_NOQUOTA(inode))
+ if (!IS_NOQUOTA(inode)) {
+ if (unlikely(inode_get_rsv_space(inode) > 0))
+ reserved = 1;
remove_inode_dquot_ref(inode, type, tofree_head);
+ }
}
spin_unlock(&inode_lock);
+#ifdef CONFIG_QUOTA_DEBUG
+ if (reserved) {
+ printk(KERN_WARNING "VFS (%s): Writes happened after quota"
+ " was disabled thus quota information is probably "
+ "inconsistent. Please run quotacheck(8).\n", sb->s_id);
+ }
+#endif
+
}
/* Gather all references from inodes and drop them */
--
1.6.6.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] ext4: force block allocation on quota_off
2010-05-28 11:27 [PATCH 1/2] ext4: force block allocation on quota_off Dmitry Monakhov
2010-05-28 11:27 ` [PATCH 2/2] quota: check quota reservation on remove_dquot_ref Dmitry Monakhov
@ 2010-05-31 19:11 ` Jan Kara
2010-06-01 7:39 ` Dmitry Monakhov
1 sibling, 1 reply; 9+ messages in thread
From: Jan Kara @ 2010-05-31 19:11 UTC (permalink / raw)
To: Dmitry Monakhov; +Cc: linux-fsdevel, linux-ext4, jack
On Fri 28-05-10 15:27:41, Dmitry Monakhov wrote:
> Perform full sync procedure to guarantee quota consistency.
The series looks OK, but please rediff the patch against the latest
Linus' tree.
Honza
>
> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
> ---
> fs/ext4/super.c | 15 ++++++++++++++-
> 1 files changed, 14 insertions(+), 1 deletions(-)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index e5166e5..4e8a7b5 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -1075,6 +1075,7 @@ static int ext4_mark_dquot_dirty(struct dquot *dquot);
> static int ext4_write_info(struct super_block *sb, int type);
> static int ext4_quota_on(struct super_block *sb, int type, int format_id,
> char *path, int remount);
> +static int ext4_quota_off(struct super_block *sb, int type, int remount);
> static int ext4_quota_on_mount(struct super_block *sb, int type);
> static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
> size_t len, loff_t off);
> @@ -1096,7 +1097,7 @@ static const struct dquot_operations ext4_quota_operations = {
>
> static const struct quotactl_ops ext4_qctl_operations = {
> .quota_on = ext4_quota_on,
> - .quota_off = vfs_quota_off,
> + .quota_off = ext4_quota_off,
> .quota_sync = vfs_quota_sync,
> .get_info = vfs_get_dqinfo,
> .set_info = vfs_set_dqinfo,
> @@ -3986,6 +3987,18 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
> return err;
> }
>
> +static int ext4_quota_off(struct super_block *sb, int type, int remount)
> +{
> + /* Force all delayed allocation blocks to be allocated */
> + if (test_opt(sb, DELALLOC) && !remount) {
> + down_read(&sb->s_umount);
> + sync_filesystem(sb);
> + up_read(&sb->s_umount);
> + }
> +
> + return vfs_quota_off(sb, type, remount);
> +}
> +
> /* Read data from quotafile - avoid pagecache and such because we cannot afford
> * acquiring the locks... As quota files are never truncated and quota code
> * itself serializes the operations (and noone else should touch the files)
> --
> 1.6.6.1
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] ext4: force block allocation on quota_off
2010-05-31 19:11 ` [PATCH 1/2] ext4: force block allocation on quota_off Jan Kara
@ 2010-06-01 7:39 ` Dmitry Monakhov
2010-06-01 7:39 ` [PATCH 2/2] quota: check quota reservation on remove_dquot_ref Dmitry Monakhov
2010-06-01 12:11 ` [PATCH 1/2] ext4: force block allocation on quota_off Jan Kara
0 siblings, 2 replies; 9+ messages in thread
From: Dmitry Monakhov @ 2010-06-01 7:39 UTC (permalink / raw)
To: linux-fsdevel, linux-ext4; +Cc: jack, Dmitry Monakhov
Perform full sync procedure to guarantee quota consistency.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/ext4/super.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 4e8983a..107fb03 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1065,6 +1065,7 @@ static int ext4_mark_dquot_dirty(struct dquot *dquot);
static int ext4_write_info(struct super_block *sb, int type);
static int ext4_quota_on(struct super_block *sb, int type, int format_id,
char *path);
+static int ext4_quota_off(struct super_block *sb, int type);
static int ext4_quota_on_mount(struct super_block *sb, int type);
static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
size_t len, loff_t off);
@@ -1086,7 +1087,7 @@ static const struct dquot_operations ext4_quota_operations = {
static const struct quotactl_ops ext4_qctl_operations = {
.quota_on = ext4_quota_on,
- .quota_off = dquot_quota_off,
+ .quota_off = ext4_quota_off,
.quota_sync = dquot_quota_sync,
.get_info = dquot_get_dqinfo,
.set_info = dquot_set_dqinfo,
@@ -3981,6 +3982,18 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
return err;
}
+static int ext4_quota_off(struct super_block *sb, int type)
+{
+ /* Force all delayed allocation blocks to be allocated */
+ if (test_opt(sb, DELALLOC)) {
+ down_read(&sb->s_umount);
+ sync_filesystem(sb);
+ up_read(&sb->s_umount);
+ }
+
+ return dquot_quota_off(sb, type);
+}
+
/* Read data from quotafile - avoid pagecache and such because we cannot afford
* acquiring the locks... As quota files are never truncated and quota code
* itself serializes the operations (and noone else should touch the files)
--
1.6.6.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] quota: check quota reservation on remove_dquot_ref
2010-06-01 7:39 ` Dmitry Monakhov
@ 2010-06-01 7:39 ` Dmitry Monakhov
2010-06-01 11:54 ` Jan Kara
2010-06-01 12:11 ` [PATCH 1/2] ext4: force block allocation on quota_off Jan Kara
1 sibling, 1 reply; 9+ messages in thread
From: Dmitry Monakhov @ 2010-06-01 7:39 UTC (permalink / raw)
To: linux-fsdevel, linux-ext4; +Cc: jack, Dmitry Monakhov
Reserved space must being claimed before remove_dquot_ref() for a
given inode. Filesystem is responsible for performing force blocks
allocation in case of dealloc in ->quota_off. Let's add sanity check
for that case. Do it similar to add_dquot_ref().
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/quota/dquot.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 12c233d..dfb8c16 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -986,6 +986,7 @@ static void remove_dquot_ref(struct super_block *sb, int type,
struct list_head *tofree_head)
{
struct inode *inode;
+ int reserved = 0;
spin_lock(&inode_lock);
list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
@@ -995,10 +996,21 @@ static void remove_dquot_ref(struct super_block *sb, int type,
* only quota pointers and these have separate locking
* (dqptr_sem).
*/
- if (!IS_NOQUOTA(inode))
+ if (!IS_NOQUOTA(inode)) {
+ if (unlikely(inode_get_rsv_space(inode) > 0))
+ reserved = 1;
remove_inode_dquot_ref(inode, type, tofree_head);
+ }
}
spin_unlock(&inode_lock);
+#ifdef CONFIG_QUOTA_DEBUG
+ if (reserved) {
+ printk(KERN_WARNING "VFS (%s): Writes happened after quota"
+ " was disabled thus quota information is probably "
+ "inconsistent. Please run quotacheck(8).\n", sb->s_id);
+ }
+#endif
+
}
/* Gather all references from inodes and drop them */
--
1.6.6.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] quota: check quota reservation on remove_dquot_ref
2010-06-01 7:39 ` [PATCH 2/2] quota: check quota reservation on remove_dquot_ref Dmitry Monakhov
@ 2010-06-01 11:54 ` Jan Kara
0 siblings, 0 replies; 9+ messages in thread
From: Jan Kara @ 2010-06-01 11:54 UTC (permalink / raw)
To: Dmitry Monakhov; +Cc: linux-fsdevel, linux-ext4, jack
On Tue 01-06-10 11:39:48, Dmitry Monakhov wrote:
> Reserved space must being claimed before remove_dquot_ref() for a
> given inode. Filesystem is responsible for performing force blocks
> allocation in case of dealloc in ->quota_off. Let's add sanity check
> for that case. Do it similar to add_dquot_ref().
Thanks. I've merged this patch since it's independent of the first one
(and unless someone runs with CONFIG_QUOTA_DEBUG it shouldn't cause
additional warnings either).
Honza
> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
> ---
> fs/quota/dquot.c | 14 +++++++++++++-
> 1 files changed, 13 insertions(+), 1 deletions(-)
>
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index 12c233d..dfb8c16 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -986,6 +986,7 @@ static void remove_dquot_ref(struct super_block *sb, int type,
> struct list_head *tofree_head)
> {
> struct inode *inode;
> + int reserved = 0;
>
> spin_lock(&inode_lock);
> list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
> @@ -995,10 +996,21 @@ static void remove_dquot_ref(struct super_block *sb, int type,
> * only quota pointers and these have separate locking
> * (dqptr_sem).
> */
> - if (!IS_NOQUOTA(inode))
> + if (!IS_NOQUOTA(inode)) {
> + if (unlikely(inode_get_rsv_space(inode) > 0))
> + reserved = 1;
> remove_inode_dquot_ref(inode, type, tofree_head);
> + }
> }
> spin_unlock(&inode_lock);
> +#ifdef CONFIG_QUOTA_DEBUG
> + if (reserved) {
> + printk(KERN_WARNING "VFS (%s): Writes happened after quota"
> + " was disabled thus quota information is probably "
> + "inconsistent. Please run quotacheck(8).\n", sb->s_id);
> + }
> +#endif
> +
> }
>
> /* Gather all references from inodes and drop them */
> --
> 1.6.6.1
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] ext4: force block allocation on quota_off
2010-06-01 7:39 ` Dmitry Monakhov
2010-06-01 7:39 ` [PATCH 2/2] quota: check quota reservation on remove_dquot_ref Dmitry Monakhov
@ 2010-06-01 12:11 ` Jan Kara
2010-06-05 14:55 ` tytso
1 sibling, 1 reply; 9+ messages in thread
From: Jan Kara @ 2010-06-01 12:11 UTC (permalink / raw)
To: Dmitry Monakhov; +Cc: linux-fsdevel, linux-ext4, jack, tytso
On Tue 01-06-10 11:39:47, Dmitry Monakhov wrote:
> Perform full sync procedure to guarantee quota consistency.
The patch looks OK to me. Acked-by: Jan Kara <jack@suse.cz>
Ted, will you merge it or should I do it?
Honza
>
> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
> ---
> fs/ext4/super.c | 15 ++++++++++++++-
> 1 files changed, 14 insertions(+), 1 deletions(-)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 4e8983a..107fb03 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -1065,6 +1065,7 @@ static int ext4_mark_dquot_dirty(struct dquot *dquot);
> static int ext4_write_info(struct super_block *sb, int type);
> static int ext4_quota_on(struct super_block *sb, int type, int format_id,
> char *path);
> +static int ext4_quota_off(struct super_block *sb, int type);
> static int ext4_quota_on_mount(struct super_block *sb, int type);
> static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
> size_t len, loff_t off);
> @@ -1086,7 +1087,7 @@ static const struct dquot_operations ext4_quota_operations = {
>
> static const struct quotactl_ops ext4_qctl_operations = {
> .quota_on = ext4_quota_on,
> - .quota_off = dquot_quota_off,
> + .quota_off = ext4_quota_off,
> .quota_sync = dquot_quota_sync,
> .get_info = dquot_get_dqinfo,
> .set_info = dquot_set_dqinfo,
> @@ -3981,6 +3982,18 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
> return err;
> }
>
> +static int ext4_quota_off(struct super_block *sb, int type)
> +{
> + /* Force all delayed allocation blocks to be allocated */
> + if (test_opt(sb, DELALLOC)) {
> + down_read(&sb->s_umount);
> + sync_filesystem(sb);
> + up_read(&sb->s_umount);
> + }
> +
> + return dquot_quota_off(sb, type);
> +}
> +
> /* Read data from quotafile - avoid pagecache and such because we cannot afford
> * acquiring the locks... As quota files are never truncated and quota code
> * itself serializes the operations (and noone else should touch the files)
> --
> 1.6.6.1
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] ext4: force block allocation on quota_off
2010-06-01 12:11 ` [PATCH 1/2] ext4: force block allocation on quota_off Jan Kara
@ 2010-06-05 14:55 ` tytso
2010-06-06 22:36 ` Jan Kara
0 siblings, 1 reply; 9+ messages in thread
From: tytso @ 2010-06-05 14:55 UTC (permalink / raw)
To: Jan Kara; +Cc: Dmitry Monakhov, linux-fsdevel, linux-ext4
On Tue, Jun 01, 2010 at 02:11:08PM +0200, Jan Kara wrote:
> On Tue 01-06-10 11:39:47, Dmitry Monakhov wrote:
> > Perform full sync procedure to guarantee quota consistency.
> The patch looks OK to me. Acked-by: Jan Kara <jack@suse.cz>
> Ted, will you merge it or should I do it?
I'll take it, but I don't think either of these is critical enough to
merge now that the merge window is closed. Agreed?
- Ted
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] ext4: force block allocation on quota_off
2010-06-05 14:55 ` tytso
@ 2010-06-06 22:36 ` Jan Kara
0 siblings, 0 replies; 9+ messages in thread
From: Jan Kara @ 2010-06-06 22:36 UTC (permalink / raw)
To: tytso; +Cc: Jan Kara, Dmitry Monakhov, linux-fsdevel, linux-ext4
On Sat 05-06-10 10:55:30, tytso@mit.edu wrote:
> On Tue, Jun 01, 2010 at 02:11:08PM +0200, Jan Kara wrote:
> > On Tue 01-06-10 11:39:47, Dmitry Monakhov wrote:
> > > Perform full sync procedure to guarantee quota consistency.
> > The patch looks OK to me. Acked-by: Jan Kara <jack@suse.cz>
> > Ted, will you merge it or should I do it?
>
> I'll take it, but I don't think either of these is critical enough to
> merge now that the merge window is closed. Agreed?
Yes, I agree.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-06-06 22:36 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-28 11:27 [PATCH 1/2] ext4: force block allocation on quota_off Dmitry Monakhov
2010-05-28 11:27 ` [PATCH 2/2] quota: check quota reservation on remove_dquot_ref Dmitry Monakhov
2010-05-31 19:11 ` [PATCH 1/2] ext4: force block allocation on quota_off Jan Kara
2010-06-01 7:39 ` Dmitry Monakhov
2010-06-01 7:39 ` [PATCH 2/2] quota: check quota reservation on remove_dquot_ref Dmitry Monakhov
2010-06-01 11:54 ` Jan Kara
2010-06-01 12:11 ` [PATCH 1/2] ext4: force block allocation on quota_off Jan Kara
2010-06-05 14:55 ` tytso
2010-06-06 22:36 ` Jan Kara
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).