mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masayuki Saito <m-saito@tnes.nec.co.jp>
To: Nathan Scott <nathans@sgi.com>, David Chinner <dgc@sgi.com>
Cc: xfs@oss.sgi.com, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] Fix i_state of inode is changed after the inode is freed [try #2]
Date: Wed, 23 Aug 2006 20:14:45 +0900	[thread overview]
Message-ID: <20060823201445m-saito@mail.aom.tnes.nec.co.jp> (raw)

Fix i_state of the inode is changed after the inode is freed.

Signed-off-by: Masayuki Saito <m-saito@tnes.nec.co.jp>
Signed-off-by: ASANO Masahiro <masano@tnes.nec.co.jp>
---

--- linux-2.6.17.7/fs/xfs/xfs_inode.c.orig	2006-08-21 20:15:58.385211286 +0900
+++ linux-2.6.17.7/fs/xfs/xfs_inode.c	2006-08-21 21:21:22.277033371 +0900
@@ -2751,18 +2751,30 @@ xfs_iunpin(
 		 * call as the inode reclaim may be blocked waiting for
 		 * the inode to become unpinned.
 		 */
+		int need_iput = 0;
+		struct inode *inode;
+		spin_lock(&ip->i_flags_lock);
 		if (!(ip->i_flags & (XFS_IRECLAIM|XFS_IRECLAIMABLE))) {
 			vnode_t	*vp = XFS_ITOV_NULL(ip);
 
 			/* make sync come back and flush this inode */
 			if (vp) {
-				struct inode	*inode = vn_to_inode(vp);
+				inode = vn_to_inode(vp);
 
-				if (!(inode->i_state & I_NEW))
-					mark_inode_dirty_sync(inode);
+				if (!(inode->i_state &
+						(I_NEW|I_FREEING|I_CLEAR))) {
+					inode = igrab(inode);
+					if (inode) {
+						need_iput = 1;
+						mark_inode_dirty_sync(inode);
+					}
+				}
 			}
 		}
+		spin_unlock(&ip->i_flags_lock);
 		wake_up(&ip->i_ipin_wait);
+		if (need_iput)
+			iput(inode);
 	}
 }

             reply	other threads:[~2006-08-23 11:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-23 11:14 Masayuki Saito [this message]
2006-08-24  7:16 ` Nathan Scott
2006-08-24 10:13   ` Masayuki Saito
2006-08-31  2:44   ` Masayuki Saito
2006-08-31  3:19     ` Nathan Scott
2006-08-31  5:06       ` Masayuki Saito

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=20060823201445m-saito@mail.aom.tnes.nec.co.jp \
    --to=m-saito@tnes.nec.co.jp \
    --cc=dgc@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathans@sgi.com \
    --cc=xfs@oss.sgi.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

all inboxes | Powered by JetHome®