diff options
author | Niu YaWei <niu@clusterfs.com> | 2005-04-16 18:25:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:25:47 -0400 |
commit | e821d94d34af23a31a16ead78e8b685b750c8c3d (patch) | |
tree | cb753d2d4e45c02c4c006383fa4d5d8dfba7a3c6 /fs/quota_v2.c | |
parent | 31e7ad6ac919761f0486f7781b02ff3ab54b6ef1 (diff) |
[PATCH] quota: possible bug in quota format v2 support
Don't put root block of quota tree to the free list (when quota file is
completely empty). That should not actually happen anyway (somebody should
get accounted for the filesystem root and so quota file should never be
empty) but better prevent it here than solve magical quota file
corruption.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/quota_v2.c')
-rw-r--r-- | fs/quota_v2.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/quota_v2.c b/fs/quota_v2.c index 19bdb7b86ca7..7afcbb1b9376 100644 --- a/fs/quota_v2.c +++ b/fs/quota_v2.c | |||
@@ -503,7 +503,8 @@ static int remove_tree(struct dquot *dquot, uint *blk, int depth) | |||
503 | int i; | 503 | int i; |
504 | ref[GETIDINDEX(dquot->dq_id, depth)] = cpu_to_le32(0); | 504 | ref[GETIDINDEX(dquot->dq_id, depth)] = cpu_to_le32(0); |
505 | for (i = 0; i < V2_DQBLKSIZE && !buf[i]; i++); /* Block got empty? */ | 505 | for (i = 0; i < V2_DQBLKSIZE && !buf[i]; i++); /* Block got empty? */ |
506 | if (i == V2_DQBLKSIZE) { | 506 | /* Don't put the root block into the free block list */ |
507 | if (i == V2_DQBLKSIZE && *blk != V2_DQTREEOFF) { | ||
507 | put_free_dqblk(sb, type, buf, *blk); | 508 | put_free_dqblk(sb, type, buf, *blk); |
508 | *blk = 0; | 509 | *blk = 0; |
509 | } | 510 | } |