From: suzuki <suzuki@linux.vnet.ibm.com>
To: Andrew Morton <akpm@osdl.org>
Cc: amitarora@in.ibm.com, "Vladimir V. Saveliev" <vs@namesys.com>,
reiserfs-list@namesys.com, reiserfs-dev@namesys.com,
lkml <linux-kernel@vger.kernel.org>,
rdunlap@xenotime.net
Subject: Re: [BUG] Reiserfs panic while running fsstress due to multiple truncate "safe links" for a file.
Date: Mon, 27 Nov 2006 18:57:33 -0800 [thread overview]
Message-ID: <456BA59D.3060208@linux.vnet.ibm.com> (raw)
In-Reply-To: <20061127172646.0d6c4dd1.akpm@osdl.org>
Andrew Morton wrote:
> On Mon, 27 Nov 2006 15:37:49 -0800
> Suzuki <suzuki@in.ibm.com> wrote:
>
>
>>* Do not add save links for O_DIRECT writes.
>>
>>We add a save link for O_DIRECT writes to protect the i_size against the crashes before we actually finish the I/O. If we hit an -ENOSPC in aops->prepare_write(), we would do a truncate() to release the blocks which might have got initialized. Now the truncate would add another save link for the same inode causing a reiserfs panic for having multiple save links for the same inode.
>>
>>
>
>
> OK...
>
> But how does this patch fix it? It removes a lot of code - how come we
> don't need it any more?
We were adding save links for appending writes only. The links were
removed once we finish the write operation successfully.
Now we don't add the save links at all.
May be Valdimir has better answers for this.
Thanks,
Suzuki
>
>
>>
>>Index: linux-2.6.19-rc1/fs/reiserfs/file.c
>>===================================================================
>>--- linux-2.6.19-rc1.orig/fs/reiserfs/file.c 2006-10-10 05:54:30.000000000 -0700
>>+++ linux-2.6.19-rc1/fs/reiserfs/file.c 2006-11-21 17:17:36.000000000 -0800
>>@@ -1306,56 +1306,8 @@
>> count = MAX_NON_LFS - (unsigned long)*ppos;
>> }
>>
>>- if (file->f_flags & O_DIRECT) { // Direct IO needs treatment
>>- ssize_t result, after_file_end = 0;
>>- if ((*ppos + count >= inode->i_size)
>>- || (file->f_flags & O_APPEND)) {
>>- /* If we are appending a file, we need to put this savelink in here.
>>- If we will crash while doing direct io, finish_unfinished will
>>- cut the garbage from the file end. */
>>- reiserfs_write_lock(inode->i_sb);
>>- err =
>>- journal_begin(&th, inode->i_sb,
>>- JOURNAL_PER_BALANCE_CNT);
>>- if (err) {
>>- reiserfs_write_unlock(inode->i_sb);
>>- return err;
>>- }
>>- reiserfs_update_inode_transaction(inode);
>>- add_save_link(&th, inode, 1 /* Truncate */ );
>>- after_file_end = 1;
>>- err =
>>- journal_end(&th, inode->i_sb,
>>- JOURNAL_PER_BALANCE_CNT);
>>- reiserfs_write_unlock(inode->i_sb);
>>- if (err)
>>- return err;
>>- }
>>- result = do_sync_write(file, buf, count, ppos);
>>-
>>- if (after_file_end) { /* Now update i_size and remove the savelink */
>>- struct reiserfs_transaction_handle th;
>>- reiserfs_write_lock(inode->i_sb);
>>- err = journal_begin(&th, inode->i_sb, 1);
>>- if (err) {
>>- reiserfs_write_unlock(inode->i_sb);
>>- return err;
>>- }
>>- reiserfs_update_inode_transaction(inode);
>>- mark_inode_dirty(inode);
>>- err = journal_end(&th, inode->i_sb, 1);
>>- if (err) {
>>- reiserfs_write_unlock(inode->i_sb);
>>- return err;
>>- }
>>- err = remove_save_link(inode, 1 /* truncate */ );
>>- reiserfs_write_unlock(inode->i_sb);
>>- if (err)
>>- return err;
>>- }
>>-
>>- return result;
>>- }
>>+ if (file->f_flags & O_DIRECT)
>>+ return do_sync_write(file, buf, count, ppos);
>>
>> if (unlikely((ssize_t) count < 0))
>> return -EINVAL;
next prev parent reply other threads:[~2006-11-28 2:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-08 11:33 [BUG] Reiserfs panic while running fsstress due to multiple truncate "safe links" for a file Suzuki
[not found] ` <20060730161348.94ecc5e0.akpm@osdl.org>
2006-11-27 23:37 ` Suzuki
2006-11-28 1:26 ` Andrew Morton
2006-11-28 2:57 ` suzuki [this message]
2006-11-30 8:44 ` Vladimir V. Saveliev
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=456BA59D.3060208@linux.vnet.ibm.com \
--to=suzuki@linux.vnet.ibm.com \
--cc=akpm@osdl.org \
--cc=amitarora@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@xenotime.net \
--cc=reiserfs-dev@namesys.com \
--cc=reiserfs-list@namesys.com \
--cc=vs@namesys.com \
/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