[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110509144201.GP4122@quack.suse.cz>
Date: Mon, 9 May 2011 16:42:01 +0200
From: Jan Kara <jack@...e.cz>
To: Ted Ts'o <tytso@....edu>
Cc: Jan Kara <jack@...e.cz>, Yongqiang Yang <xiaoqiangnk@...il.com>,
Allison Henderson <achender@...ux.vnet.ibm.com>,
Ext4 Developers List <linux-ext4@...r.kernel.org>
Subject: Re: [PATCH 1/1] Null Pointer when make_indexed_dir returns -ENOSPC
On Mon 09-05-11 10:22:37, Ted Tso wrote:
> On Mon, May 09, 2011 at 04:05:37PM +0200, Jan Kara wrote:
> > Yes. ext4_append() can return ENOSPC and passed bh will get set to NULL
> > without being marked dirty.
>
> Ah, so the right fix then is to add to make the cleanup code like this:
>
> ext4_mark_inode_dirty(handle, dir);
> ext4_handle_dirty_metadata(handle, dir, frame->bh);
> + ext4_handle_dirty_metadata(handle, dir, bh2);
> + if (bh)
> + ext4_handle_dirty_metadata(handle, dir, bh);
> dx_release(frames);
> return retval;
>
> Agreed?
Not quite. make_indexed_dir() does frame->bh = bh and bh = bh2 before
calling do_split(). So bh2 is not really carrying a valid buffer reference
at this point - even more so because do_split() does brelse() on the passed
bh so it need not be around when are at this point. The code is a real
mess. But for example attached patch will work because both callers of
do_split() do brelse() anyway.
Honza
--
Jan Kara <jack@...e.cz>
SUSE Labs, CR
View attachment "0001-ext4-Stop-releasing-passed-bh-in-do_split.patch" of type "text/x-patch" (1171 bytes)
Powered by blists - more mailing lists