From: "Gorka Guardiola" <paurealkml@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Buffer head async write
Date: Wed, 30 Aug 2006 13:54:19 -0500 [thread overview]
Message-ID: <dc081bb90608301154tc87f44fxe60c68af6415ce1a@mail.gmail.com> (raw)
I am trying to mark a buffer for async write, but I am having a race condition
to unlock the buffer. I am doing.
bh = getbmapst(bdev, nsect); //this function calls bread
if (!bh) {
printk(KERN_ALERT "I/O error, bitmap cannot be trusted\n");
return -1;
}
lock_buffer(bh);
byte = bh->b_data + byteoffset;
*byte |= 1 << bitoffset;
lock_page(bh->b_page);
mark_page_accessed(bh->b_page);
__set_page_dirty_nobuffers(bh->b_page);
unlock_page(bh->b_page);
set_buffer_uptodate(bh);
mark_buffer_dirty(bh);
mark_buffer_async_write(bh);
unlock_buffer(bh);
brelse(bh);
What I want is the buffer head not to write synchronously when I do
the brelse, to
coalesce writes on it. It works normally, but this code has some form
of race condition.
The problem is that (in some circumstances, for example while using a
loop device against a file) this makes the fs/buffer.c:603
BUG_ON break. I am using the latest version of the kernel with SMP on a machine
with 4 processors.
Can anybody tell me what am I doing wrong?. I tried some other schemes, like
bit_spin_locking the BH_Uptodate_Lock, but they didn't work either.
next reply other threads:[~2006-08-30 18:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-30 18:54 Gorka Guardiola [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-08-30 16:35 Gorka Guardiola
2006-08-30 23:59 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dc081bb90608301154tc87f44fxe60c68af6415ce1a@mail.gmail.com \
--to=paurealkml@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®