mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [patch 02/12] document i_size_write locking rules
Date: Mon, 16 Oct 2006 18:27:11 +0200	[thread overview]
Message-ID: <20061016162731.445990000@szeredi.hu> (raw)
In-Reply-To: <20061016162709.369579000@szeredi.hu>

[-- Attachment #1: document_i_size_write_locking.patch --]
[-- Type: text/plain, Size: 921 bytes --]

Unless someone reads the documentation for write_seqcount_{begin,end}
it is not obvious, that i_size_write() needs locking.  Especially,
that lack of such locking can result in a system hang.

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>

---
Index: linux/include/linux/fs.h
===================================================================
--- linux.orig/include/linux/fs.h	2006-10-16 12:53:03.000000000 +0200
+++ linux/include/linux/fs.h	2006-10-16 14:10:22.000000000 +0200
@@ -670,7 +670,11 @@ static inline loff_t i_size_read(struct 
 #endif
 }
 
-
+/*
+ * NOTE: unlike i_size_read(), i_size_write() does need locking around it
+ * (normally i_mutex), otherwise on 32bit/SMP an update of i_size_seqcount
+ * can be lost, resulting in subsequent i_size_read() calls spinning forever.
+ */
 static inline void i_size_write(struct inode *inode, loff_t i_size)
 {
 #if BITS_PER_LONG==32 && defined(CONFIG_SMP)

--

  parent reply	other threads:[~2006-10-16 16:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-16 16:27 [patch 00/12] fuse update Miklos Szeredi
2006-10-16 16:27 ` [patch 01/12] fuse: fix hang on SMP Miklos Szeredi
2006-10-16 23:51   ` Andrew Morton
2006-10-17 12:53     ` Mike Day
2006-10-17 13:43       ` Miklos Szeredi
2006-10-16 16:27 ` Miklos Szeredi [this message]
2006-10-16 16:27 ` [patch 03/12] fuse: locking fix for nlookup Miklos Szeredi
2006-10-16 16:27 ` [patch 04/12] fuse: fix spurious BUG Miklos Szeredi
2006-10-16 16:27 ` [patch 05/12] fuse: fix handling of moved directory Miklos Szeredi
2006-10-16 16:27 ` [patch 06/12] fuse: fix dereferencing dentry parent Miklos Szeredi
2006-10-16 16:27 ` [patch 07/12] fuse: update userspace interface to version 7.8 Miklos Szeredi
2006-10-16 16:27 ` [patch 08/12] fuse: minor cleanup in fuse_dentry_revalidate Miklos Szeredi
2006-10-16 16:27 ` [patch 09/12] fuse: add support for block device based filesystems Miklos Szeredi
2006-10-16 16:27 ` [patch 10/12] fuse: add blksize option Miklos Szeredi
2006-10-16 16:27 ` [patch 11/12] fuse: add bmap support Miklos Szeredi
2006-10-16 16:27 ` [patch 12/12] fuse: add DESTROY operation Miklos Szeredi

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=20061016162731.445990000@szeredi.hu \
    --to=miklos@szeredi.hu \
    --cc=akpm@osdl.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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®