linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Reiser <reiser@namesys.com>
To: marcelo@conectiva.com.br, linux-kernel@vger.kernel.org,
	reiserfs-dev@namesys.com
Subject: [BK] [2.4] Reiserfs changeset 3 out of 4, please apply.
Date: Tue, 7 May 2002 19:05:44 +0400	[thread overview]
Message-ID: <200205071505.g47F5iT04042@namesys.com> (raw)

Hello!

  You can get this changeset from bk://thebsh.namesys.com/bk/reiser3-linux-2.4

  This changeset  fixes 2 incorrect padding problems and a race with knfsd,
  where file might be attemted to be deleted twice.

Diffstat:
 inode.c           |   17 ++++++++++++-----
 namei.c           |    2 +-
 tail_conversion.c |    2 +-
 3 files changed, 14 insertions(+), 7 deletions(-)

Plain text patch
# 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.383.2.39 -> 1.383.2.40
#	 fs/reiserfs/namei.c	1.20    -> 1.21   
#	 fs/reiserfs/inode.c	1.33    -> 1.34   
#	fs/reiserfs/tail_conversion.c	1.11    -> 1.12   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/04/30	green@angband.namesys.com	1.383.2.40
# inode.c:
#   implemented reiserfs_make_bad_inode() function that
#   zeroes inode key therefore avoiding races with knfsd
#   and other stuff that might access files bypassing directory lookups
# tail_conversion.c:
#   old format DIRECT items were incorrectly aligned on new format filesystems
# namei.c:
#   old format DIR entries were incorrectly aligned on new format filesystems
# --------------------------------------------
#
diff -Nru a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
--- a/fs/reiserfs/inode.c	Tue May  7 17:54:21 2002
+++ b/fs/reiserfs/inode.c	Tue May  7 17:54:21 2002
@@ -1128,8 +1128,15 @@
     return;
 }
 
+/* We need to clear inode key in private part of inode to avoid races between
+   blocking iput, knfsd and file deletion with creating of safelinks.*/
+static void reiserfs_make_bad_inode(struct inode *inode) {
+    memset(INODE_PKEY(inode), 0, KEY_SIZE);
+    make_bad_inode(inode);
+}
+
 void reiserfs_read_inode(struct inode *inode) {
-    make_bad_inode(inode) ;
+    reiserfs_make_bad_inode(inode) ;
 }
 
 
@@ -1144,7 +1151,7 @@
     int retval;
 
     if (!p) {
-	make_bad_inode(inode) ;
+	reiserfs_make_bad_inode(inode) ;
 	return;
     }
 
@@ -1164,13 +1171,13 @@
 	reiserfs_warning ("vs-13070: reiserfs_read_inode2: "
                     "i/o failure occurred trying to find stat data of %K\n",
                     &key);
-	make_bad_inode(inode) ;
+	reiserfs_make_bad_inode(inode) ;
 	return;
     }
     if (retval != ITEM_FOUND) {
 	/* a stale NFS handle can trigger this without it being an error */
 	pathrelse (&path_to_sd);
-	make_bad_inode(inode) ;
+	reiserfs_make_bad_inode(inode) ;
 	inode->i_nlink = 0;
 	return;
     }
@@ -1197,7 +1204,7 @@
 			      "dead inode read from disk %K. "
 			      "This is likely to be race with knfsd. Ignore\n", 
 			      &key );
-	    make_bad_inode( inode );
+	    reiserfs_make_bad_inode( inode );
     }
 
     reiserfs_check_path(&path_to_sd) ; /* init inode should be relsing */
diff -Nru a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
--- a/fs/reiserfs/namei.c	Tue May  7 17:54:21 2002
+++ b/fs/reiserfs/namei.c	Tue May  7 17:54:21 2002
@@ -388,7 +388,7 @@
     } else
 	buffer = small_buf;
 
-    paste_size = (old_format_only (dir->i_sb)) ? (DEH_SIZE + namelen) : buflen;
+    paste_size = (get_inode_sd_version (dir) == STAT_DATA_V1) ? (DEH_SIZE + namelen) : buflen;
 
     /* fill buffer : directory entry head, name[, dir objectid | , stat data | ,stat data, dir objectid ] */
     deh = (struct reiserfs_de_head *)buffer;
diff -Nru a/fs/reiserfs/tail_conversion.c b/fs/reiserfs/tail_conversion.c
--- a/fs/reiserfs/tail_conversion.c	Tue May  7 17:54:21 2002
+++ b/fs/reiserfs/tail_conversion.c	Tue May  7 17:54:21 2002
@@ -213,7 +213,7 @@
     copy_item_head (&s_ih, PATH_PITEM_HEAD(p_s_path));
 
     tail_len = (n_new_file_size & (n_block_size - 1));
-    if (!old_format_only (p_s_sb))
+    if (get_inode_sd_version (p_s_inode) == STAT_DATA_V2)
 	round_tail_len = ROUND_UP (tail_len);
     else
 	round_tail_len = tail_len;

                 reply	other threads:[~2002-05-07 15:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200205071505.g47F5iT04042@namesys.com \
    --to=reiser@namesys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    --cc=reiserfs-dev@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;
as well as URLs for NNTP newsgroup(s).