public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin LaHaise <bcrl@redhat.com>
To: Linus Torvalds <torvalds@transmeta.com>,
	Alexander Viro <viro@math.psu.edu>
Cc: linux-kernel@vger.kernel.org
Subject: [bkpatch] fs/inode.c sync fix and fs/ext2/inode.c tidy
Date: Thu, 7 Mar 2002 16:11:40 -0500	[thread overview]
Message-ID: <20020307161140.F17842@redhat.com> (raw)

These patches can be pulled from bk://bcrlbits.bkbits.net/linux-2.5
First one: in fs/ext2/inode.c merge ext2_fsync_inode into ext2_sync_file 
as that's the only place it can be called from.

Second one only touches fs/inode.c:sync_one to replace the if I_LOCK 
check with a while.  Basically, the inode sync could end up deferring 
to writeback if the inode is already locked.  This breaks things like 
O_SYNC which assume the inode sync is synchronous and only returns 
when the data is safely on disk.  This patch will need to go into 2.4 
after a bit of testing for unexpected interactions.

Patches are included below for reading.

		-ben
-- 
"A man with a bass just walked in,
 and he's putting it down
 on the floor."

diff -Nru a/fs/ext2/ext2.h b/fs/ext2/ext2.h
--- a/fs/ext2/ext2.h	Thu Mar  7 16:02:59 2002
+++ b/fs/ext2/ext2.h	Thu Mar  7 16:02:59 2002
@@ -63,7 +63,6 @@
 
 /* fsync.c */
 extern int ext2_sync_file (struct file *, struct dentry *, int);
-extern int ext2_fsync_inode (struct inode *, int);
 
 /* ialloc.c */
 extern struct inode * ext2_new_inode (struct inode *, int);
diff -Nru a/fs/ext2/fsync.c b/fs/ext2/fsync.c
--- a/fs/ext2/fsync.c	Thu Mar  7 16:02:59 2002
+++ b/fs/ext2/fsync.c	Thu Mar  7 16:02:59 2002
@@ -35,11 +35,6 @@
 int ext2_sync_file(struct file * file, struct dentry *dentry, int datasync)
 {
 	struct inode *inode = dentry->d_inode;
-	return ext2_fsync_inode(inode, datasync);
-}
-
-int ext2_fsync_inode(struct inode *inode, int datasync)
-{
 	int err;
 	
 	err  = fsync_inode_buffers(inode);






diff -Nru a/fs/inode.c b/fs/inode.c
--- a/fs/inode.c	Thu Mar  7 16:02:59 2002
+++ b/fs/inode.c	Thu Mar  7 16:02:59 2002
@@ -291,15 +291,15 @@
 
 static inline void sync_one(struct inode *inode, int sync)
 {
-	if (inode->i_state & I_LOCK) {
+	while (inode->i_state & I_LOCK) {
 		__iget(inode);
 		spin_unlock(&inode_lock);
 		__wait_on_inode(inode);
 		iput(inode);
 		spin_lock(&inode_lock);
-	} else {
-		__sync_one(inode, sync);
 	}
+
+	__sync_one(inode, sync);
 }
 
 static inline void sync_list(struct list_head *head)

                 reply	other threads:[~2002-03-07 21:12 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=20020307161140.F17842@redhat.com \
    --to=bcrl@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    --cc=viro@math.psu.edu \
    /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