From: Oleg Drokin <green@namesys.com>
To: Manuel Krause <manuelkrause@netscape.net>
Cc: reiserfs-list <reiserfs-list@namesys.com>
Subject: Re: Data-logging and md as / fs bug
Date: Tue, 13 May 2003 18:25:01 +0400 [thread overview]
Message-ID: <20030513142501.GI12963@namesys.com> (raw)
In-Reply-To: <3EC0FE02.9030007@netscape.net>
Hello!
On Tue, May 13, 2003 at 04:15:30PM +0200, Manuel Krause wrote:
> Do you have something new to try? Does this original patch affect disk
> i/o perfomance (positive/negative)?
No. I have old patch instead that applies to 2.4.20 and basically every other kernel
and that I am pushing to Marchelo as this iget5_locked is too intrusive at current 2.4
development stage.
This old patch is attached.
> Always appreciated are less intrusive ones regarding i/o speed ;-))
I/O speed should be the same with all the aproaches.
The patch below is a bit more cpu hungry as it introduces one more spinlock.
Bye,
Oleg
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1209 -> 1.1210
# fs/reiserfs/inode.c 1.42 -> 1.43
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/05/12 green@angband.namesys.com 1.1210
# reiserfs: iget4() race fix
# --------------------------------------------
#
diff -Nru a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
--- a/fs/reiserfs/inode.c Tue May 13 18:24:37 2003
+++ b/fs/reiserfs/inode.c Tue May 13 18:24:37 2003
@@ -20,6 +20,10 @@
static int reiserfs_get_block (struct inode * inode, long block,
struct buffer_head * bh_result, int create);
+/* This spinlock guards inode pkey in private part of inode
+ against race between find_actor() vs reiserfs_read_inode2 */
+static spinlock_t keycopy_lock = SPIN_LOCK_UNLOCKED;
+
void reiserfs_delete_inode (struct inode * inode)
{
int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2;
@@ -898,8 +902,9 @@
bh = PATH_PLAST_BUFFER (path);
ih = PATH_PITEM_HEAD (path);
-
+ spin_lock(&keycopy_lock);
copy_key (INODE_PKEY (inode), &(ih->ih_key));
+ spin_unlock(&keycopy_lock);
inode->i_blksize = PAGE_SIZE;
INIT_LIST_HEAD(&inode->u.reiserfs_i.i_prealloc_list) ;
@@ -1220,10 +1225,27 @@
unsigned long inode_no, void *opaque )
{
struct reiserfs_iget4_args *args;
+ int retval;
args = opaque;
+ /* We protect against possible parallel init_inode() on another CPU here. */
+ spin_lock(&keycopy_lock);
/* args is already in CPU order */
- return le32_to_cpu(INODE_PKEY(inode)->k_dir_id) == args -> objectid;
+ if (le32_to_cpu(INODE_PKEY(inode)->k_dir_id) == args -> objectid)
+ retval = 1;
+ else
+ /* If The key does not match, lets see if we are racing
+ with another iget4, that already progressed so far
+ to reiserfs_read_inode2() and was preempted in
+ call to search_by_key(). The signs of that are:
+ Inode is locked
+ dirid and object id are zero (not yet initialized)*/
+ retval = (inode->i_state & I_LOCK) &&
+ !INODE_PKEY(inode)->k_dir_id &&
+ !INODE_PKEY(inode)->k_objectid;
+
+ spin_unlock(&keycopy_lock);
+ return retval;
}
struct inode * reiserfs_iget (struct super_block * s, const struct cpu_key * key)
next prev parent reply other threads:[~2003-05-13 14:25 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-03 0:07 Data-logging for 2.4.21-rc1+ (again) Manuel Krause
2003-05-03 10:31 ` Oleg Drokin
2003-05-06 19:34 ` Data-logging and md as / fs bug Christian Mayrhuber
2003-05-06 19:44 ` Chris Mason
2003-05-06 19:56 ` Dieter Nützel
2003-05-08 13:31 ` Chris Mason
2003-05-09 20:21 ` Manuel Krause
2003-05-11 12:58 ` Chris Mason
2003-05-12 7:29 ` Oleg Drokin
2003-05-13 14:15 ` Manuel Krause
2003-05-13 14:25 ` Oleg Drokin [this message]
2003-05-13 15:00 ` Manuel Krause
2003-05-13 14:59 ` Oleg Drokin
2003-05-13 15:39 ` Manuel Krause
2003-05-13 15:42 ` Oleg Drokin
2003-05-15 13:31 ` Manuel Krause
2003-05-13 21:52 ` Newsmail
2003-05-13 22:18 ` Christian Mayrhuber
2003-05-14 5:40 ` Oleg Drokin
2003-05-06 20:53 ` Christian Mayrhuber
2003-05-06 21:22 ` Chris Mason
2003-05-07 12:34 ` Chris Mason
2003-05-07 14:41 ` Christian Mayrhuber
2003-05-07 14:43 ` Chris Mason
2003-05-07 14:52 ` Christian Mayrhuber
2003-05-07 15:23 ` Chris Mason
2003-05-08 13:35 ` Chris Mason
2003-05-12 7:37 ` Oleg Drokin
-- strict thread matches above, loose matches on Subject: below --
2003-05-09 11:17 Kerin Millar
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=20030513142501.GI12963@namesys.com \
--to=green@namesys.com \
--cc=manuelkrause@netscape.net \
--cc=reiserfs-list@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.