linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Possible bug in ext3 versus filter drivers in 2.4.18-3, 2.4.18-14 and 2.4.20.
@ 2003-02-18 12:17 Alexander Sandler
  2003-02-20  1:15 ` Tim Pepper
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Sandler @ 2003-02-18 12:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ohad Levin

Hi list.

I am working on a filter driver. 

In my driver, I am monitoring whether requests I redirected to other driver were successful or not. To do so, I am replacing b_end_io and b_private fields in buffer header. This way, instead of calling the default completion routine, system is calling my completion routine, which used to, among the other things, recover original b_end_io and b_private fields from value I placed in b_private when mapped the request and call original b_end_io with appropriate uptodate value. 

The problem with ext3 is that it is accessing b_private field in locked buffer headers. It is treating b_private field I placed in buffer header, as journal header. As a result, I am getting multiple segmentation faults in different places and you can imagine what else. 

The problem starts somewhere in ext3_new_block() in fs/ext3/balloc.c. In the begging it's obtaining buffer header and eventually it's calling __ext3_journal_get_undo_access() in  include/linux/ext3_jbd.h. From there, it goes to journal_get_undo_access() in fs/jbd/transaction.c, then to journal_add_journal_head() in fs/jbd/journal.c and so on. Journal header is obtained in line stating "jh = bh2jh(bh);" in journal_add_journal_head().

I see two possible fixes. First, we can make sure filter drivers do not change b_private field in buffer header. It seems to be quite odd solution since as far as I understood, this is what b_private filed is there for (among the other things of course). Other option is to make sure that ext3_new_block() won't access locked buffer headers. This seems to be more reasonable. 
I am afraid I am not really an expert in file systems in general and in ext3 in particularly, so I don't know what exactly to do. Perhaps someone can fix this thing or guide me how to do so.

Finally, I found this thing in 2.4.18-3 (RH 7.3). I checked 2.4.18-14 (RH 8.0) and 2.4.20. It seems that the problem is there for all three versions of kernel.

Thank you.

Alexandr Sandler.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Possible bug in ext3 versus filter drivers in 2.4.18-3, 2.4.18-14 and 2.4.20.
  2003-02-18 12:17 Possible bug in ext3 versus filter drivers in 2.4.18-3, 2.4.18-14 and 2.4.20 Alexander Sandler
@ 2003-02-20  1:15 ` Tim Pepper
  0 siblings, 0 replies; 2+ messages in thread
From: Tim Pepper @ 2003-02-20  1:15 UTC (permalink / raw)
  To: Alexander Sandler; +Cc: linux-kernel, Ohad Levin

Yes...fix in -ac.  Comments from fix in 2.4.21pre.

t.
-- 
*********************************************************
*  tpepper@vato dot org             * Venimus, Vidimus, *
*  http://www.vato.org/~tpepper     * Dolavimus         *
*********************************************************

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-02-20  1:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-18 12:17 Possible bug in ext3 versus filter drivers in 2.4.18-3, 2.4.18-14 and 2.4.20 Alexander Sandler
2003-02-20  1:15 ` Tim Pepper

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).