]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
reiserfs: don't preallocate blocks for extended attributes
authorJeff Mahoney <jeffm@suse.com>
Thu, 22 Jun 2017 20:35:04 +0000 (16:35 -0400)
committerJan Kara <jack@suse.cz>
Fri, 23 Jun 2017 07:40:24 +0000 (09:40 +0200)
Most extended attributes will fit in a single block.  More importantly,
we drop the reference to the inode while holding the transaction open
so the preallocated blocks aren't released.  As a result, the inode
may be evicted before it's removed from the transaction's prealloc list
which can cause memory corruption.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/reiserfs/bitmap.c

index dc198bc64c61ddae9db7a936365a820d71abf2d0..a6f39fe2b6643d76232e389fb94a46586205c853 100644 (file)
@@ -1128,7 +1128,7 @@ static int determine_prealloc_size(reiserfs_blocknr_hint_t * hint)
        hint->prealloc_size = 0;
 
        if (!hint->formatted_node && hint->preallocate) {
-               if (S_ISREG(hint->inode->i_mode)
+               if (S_ISREG(hint->inode->i_mode) && !IS_PRIVATE(hint->inode)
                    && hint->inode->i_size >=
                    REISERFS_SB(hint->th->t_super)->s_alloc_options.
                    preallocmin * hint->inode->i_sb->s_blocksize)