diff options
author | Dmitry Monakhov <dmonakhov@openvz.org> | 2011-10-29 09:05:00 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-10-29 09:05:00 -0400 |
commit | 5cb81dabcc28863e7d04e6fd9ede154bd8459c14 (patch) | |
tree | 704df9fffdc243449dc5eba697cec133162ee1bf /fs/ext4/migrate.c | |
parent | fba90ffee813e2425feb9a57c532b3d297af18c3 (diff) |
ext4: fix quota accounting during migration
The tmp_inode should have same uid/gid as the original inode.
Otherwise new metadata blocks will be accounted to wrong quota-id,
which will result in a quota leak after the inode migration is
completed.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/migrate.c')
-rw-r--r-- | fs/ext4/migrate.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index 8a9a0912fdae..f729377bf043 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c | |||
@@ -439,6 +439,7 @@ int ext4_ext_migrate(struct inode *inode) | |||
439 | struct migrate_struct lb; | 439 | struct migrate_struct lb; |
440 | unsigned long max_entries; | 440 | unsigned long max_entries; |
441 | __u32 goal; | 441 | __u32 goal; |
442 | uid_t owner[2]; | ||
442 | 443 | ||
443 | /* | 444 | /* |
444 | * If the filesystem does not support extents, or the inode | 445 | * If the filesystem does not support extents, or the inode |
@@ -466,10 +467,12 @@ int ext4_ext_migrate(struct inode *inode) | |||
466 | } | 467 | } |
467 | goal = (((inode->i_ino - 1) / EXT4_INODES_PER_GROUP(inode->i_sb)) * | 468 | goal = (((inode->i_ino - 1) / EXT4_INODES_PER_GROUP(inode->i_sb)) * |
468 | EXT4_INODES_PER_GROUP(inode->i_sb)) + 1; | 469 | EXT4_INODES_PER_GROUP(inode->i_sb)) + 1; |
470 | owner[0] = inode->i_uid; | ||
471 | owner[1] = inode->i_gid; | ||
469 | tmp_inode = ext4_new_inode(handle, inode->i_sb->s_root->d_inode, | 472 | tmp_inode = ext4_new_inode(handle, inode->i_sb->s_root->d_inode, |
470 | S_IFREG, NULL, goal); | 473 | S_IFREG, NULL, goal, owner); |
471 | if (IS_ERR(tmp_inode)) { | 474 | if (IS_ERR(tmp_inode)) { |
472 | retval = -ENOMEM; | 475 | retval = PTR_ERR(inode); |
473 | ext4_journal_stop(handle); | 476 | ext4_journal_stop(handle); |
474 | return retval; | 477 | return retval; |
475 | } | 478 | } |