* Re: [PATCH] one-liner fix for bforget() honoring BH_Protected; was: Re: Patch (repost): cramfs memory corruption fix
@ 2001-01-11 3:08 Adam J. Richter
0 siblings, 0 replies; 3+ messages in thread
From: Adam J. Richter @ 2001-01-11 3:08 UTC (permalink / raw)
To: parsley, torvalds; +Cc: linux-kernel
>From: "David L. Parsley" <parsley@linuxjedi.org>
>Linus Torvalds wrote:
>> On Sat, 6 Jan 2001, Adam J. Richter wrote:
>> >
>> > This sounds like a bug that I posted a fix for a long time ago.
>> > cramfs calls bforget on the superblock area, destroying that block of
>> > the ramdisk, even when the ramdisk does not contain a cramfs file system.
>> > Normally, bforget is called on block that really can be trashed,
>> > such as blocks release by truncate or unlink.
>>
>> I'd really prefer just not letting bforget() touch BH_Protected buffers.
>> bforget() is also used by other things than unlink/truncate: it's used by
>> various partition codes etc, and it's used by the raid logic.
>Yup, I backed out Adam's one-liner in favor of the attached one-liner.
>Tested on 2.4.0, but should patch cleanly to just about anything. ;-)
Applying Linus's patch is fine, but I think my patch should also
be applied (in addition), although for a less important reason. The
bforget in cramfs is going to force unnecessary device IO if cramfs
is in the list of file systems that you are trying to detect when
mounting a file system from a physical device.
Adam J. Richter __ ______________ 4880 Stevens Creek Blvd, Suite 104
adam@yggdrasil.com \ / San Jose, California 95129-1034
+1 408 261-6630 | g g d r a s i l United States of America
fax +1 408 261-6631 "Free Software For The Rest Of Us."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] one-liner fix for bforget() honoring BH_Protected; was: Re: Patch (repost): cramfs memory corruption fix
2001-01-10 23:30 ` [PATCH] one-liner fix for bforget() honoring BH_Protected; was: " David L. Parsley
@ 2001-01-11 4:23 ` Linus Torvalds
0 siblings, 0 replies; 3+ messages in thread
From: Linus Torvalds @ 2001-01-11 4:23 UTC (permalink / raw)
To: David L. Parsley; +Cc: Adam J. Richter, parsley, linux-kernel
On Wed, 10 Jan 2001, David L. Parsley wrote:
>
> Yup, I backed out Adam's one-liner in favor of the attached one-liner.
> Tested on 2.4.0, but should patch cleanly to just about anything. ;-)
>
> BTW Linus - you were of course right on the cramfs wanting 4096
> blocksize... but without this fix, that doesn't matter much. ;-)
So everything works the way you want it now? Just checking that there
aren't any outstanding issues..
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] one-liner fix for bforget() honoring BH_Protected; was: Re: Patch (repost): cramfs memory corruption fix
2001-01-08 3:46 Linus Torvalds
@ 2001-01-10 23:30 ` David L. Parsley
2001-01-11 4:23 ` Linus Torvalds
0 siblings, 1 reply; 3+ messages in thread
From: David L. Parsley @ 2001-01-10 23:30 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Adam J. Richter, parsley, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 986 bytes --]
Linus Torvalds wrote:
>
> On Sat, 6 Jan 2001, Adam J. Richter wrote:
> >
> > This sounds like a bug that I posted a fix for a long time ago.
> > cramfs calls bforget on the superblock area, destroying that block of
> > the ramdisk, even when the ramdisk does not contain a cramfs file system.
> > Normally, bforget is called on block that really can be trashed,
> > such as blocks release by truncate or unlink.
>
> I'd really prefer just not letting bforget() touch BH_Protected buffers.
> bforget() is also used by other things than unlink/truncate: it's used by
> various partition codes etc, and it's used by the raid logic.
Yup, I backed out Adam's one-liner in favor of the attached one-liner.
Tested on 2.4.0, but should patch cleanly to just about anything. ;-)
BTW Linus - you were of course right on the cramfs wanting 4096
blocksize... but without this fix, that doesn't matter much. ;-)
regards,
David
--
David L. Parsley
Network Administrator
Roanoke College
[-- Attachment #2: bforgetfix.diff --]
[-- Type: text/plain, Size: 684 bytes --]
--- linux.linus/fs/buffer.c Wed Jan 3 23:45:26 2001
+++ linux/fs/buffer.c Wed Jan 10 15:49:36 2001
@@ -1145,13 +1145,15 @@
* free list if it can.. We can NOT free the buffer if:
* - there are other users of it
* - it is locked and thus can have active IO
+ * - it is marked BH_Protected
*/
void __bforget(struct buffer_head * buf)
{
/* grab the lru lock here to block bdflush. */
spin_lock(&lru_list_lock);
write_lock(&hash_table_lock);
- if (!atomic_dec_and_test(&buf->b_count) || buffer_locked(buf))
+ if (!atomic_dec_and_test(&buf->b_count) || buffer_locked(buf) ||
+ buffer_protected(buf))
goto in_use;
__hash_unlink(buf);
remove_inode_queue(buf);
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-01-11 4:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-11 3:08 [PATCH] one-liner fix for bforget() honoring BH_Protected; was: Re: Patch (repost): cramfs memory corruption fix Adam J. Richter
-- strict thread matches above, loose matches on Subject: below --
2001-01-08 3:46 Linus Torvalds
2001-01-10 23:30 ` [PATCH] one-liner fix for bforget() honoring BH_Protected; was: " David L. Parsley
2001-01-11 4:23 ` Linus Torvalds
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®