All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: akpm@linux-foundation.org, Al Viro <viro@ftp.linux.org.uk>
Cc: linux-kernel@vger.kernel.org, Randy Dunlap <rddunlap@osdl.org>,
	Martin Bligh <mbligh@google.com>,
	Fengguang Wu <wfg@mail.ustc.edu.cn>
Subject: [PATCH] Fix f_version type: should be u64 instead of unsigned long
Date: Sat, 18 Aug 2007 12:09:06 -0400	[thread overview]
Message-ID: <20070818160906.GA22844@Krystal> (raw)
In-Reply-To: <20070815084625.GA18892@mail.ustc.edu.cn>

Fix f_version type: should be u64 instead of long

There is a type inconsistency between struct inode i_version and struct file
f_version.

fs.h:

struct inode
  u64                     i_version;

and

struct file
  unsigned long           f_version;

Users do:

fs/ext3/dir.c:

if (filp->f_version != inode->i_version) {

So why isn't f_version a u64 ? It becomes a problem if versions gets
higher than 2^32 and we are on an architecture where longs are 32 bits.

This patch changes the f_version type to u64, and updates the users accordingly.

It applies to 2.6.23-rc2-mm2.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: Martin Bligh <mbligh@google.com>
CC: Randy Dunlap <rddunlap@osdl.org>
CC: Al Viro <viro@ftp.linux.org.uk>
---
 fs/ext3/dir.c            |    2 +-
 fs/ext4/dir.c            |    2 +-
 fs/ocfs2/dir.c           |    2 +-
 fs/proc/base.c           |    4 ++--
 include/linux/fs.h       |    2 +-
 include/linux/seq_file.h |    2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

Index: linux-2.6-lttng/include/linux/fs.h
===================================================================
--- linux-2.6-lttng.orig/include/linux/fs.h	2007-08-18 11:05:10.000000000 -0400
+++ linux-2.6-lttng/include/linux/fs.h	2007-08-18 11:05:56.000000000 -0400
@@ -799,7 +799,7 @@ struct file {
 	unsigned int		f_uid, f_gid;
 	struct file_ra_state	f_ra;
 
-	unsigned long		f_version;
+	u64			f_version;
 #ifdef CONFIG_SECURITY
 	void			*f_security;
 #endif
Index: linux-2.6-lttng/fs/ext3/dir.c
===================================================================
--- linux-2.6-lttng.orig/fs/ext3/dir.c	2007-08-18 11:08:25.000000000 -0400
+++ linux-2.6-lttng/fs/ext3/dir.c	2007-08-18 11:08:32.000000000 -0400
@@ -210,7 +210,7 @@ revalidate:
 				 * not the directory has been modified
 				 * during the copy operation.
 				 */
-				unsigned long version = filp->f_version;
+				u64 version = filp->f_version;
 
 				error = filldir(dirent, de->name,
 						de->name_len,
Index: linux-2.6-lttng/fs/ext4/dir.c
===================================================================
--- linux-2.6-lttng.orig/fs/ext4/dir.c	2007-08-18 11:08:47.000000000 -0400
+++ linux-2.6-lttng/fs/ext4/dir.c	2007-08-18 11:08:53.000000000 -0400
@@ -210,7 +210,7 @@ revalidate:
 				 * not the directory has been modified
 				 * during the copy operation.
 				 */
-				unsigned long version = filp->f_version;
+				u64 version = filp->f_version;
 
 				error = filldir(dirent, de->name,
 						de->name_len,
Index: linux-2.6-lttng/fs/ocfs2/dir.c
===================================================================
--- linux-2.6-lttng.orig/fs/ocfs2/dir.c	2007-08-18 11:09:23.000000000 -0400
+++ linux-2.6-lttng/fs/ocfs2/dir.c	2007-08-18 11:09:30.000000000 -0400
@@ -183,7 +183,7 @@ revalidate:
 				 * not the directory has been modified
 				 * during the copy operation.
 				 */
-				unsigned long version = filp->f_version;
+				u64 version = filp->f_version;
 				unsigned char d_type = DT_UNKNOWN;
 
 				if (de->file_type < OCFS2_FT_MAX)
Index: linux-2.6-lttng/fs/proc/base.c
===================================================================
--- linux-2.6-lttng.orig/fs/proc/base.c	2007-08-18 11:11:21.000000000 -0400
+++ linux-2.6-lttng/fs/proc/base.c	2007-08-18 11:11:39.000000000 -0400
@@ -2570,7 +2570,7 @@ static int proc_task_readdir(struct file
 	/* f_version caches the tgid value that the last readdir call couldn't
 	 * return. lseek aka telldir automagically resets f_version to 0.
 	 */
-	tid = filp->f_version;
+	tid = (int)filp->f_version;
 	filp->f_version = 0;
 	for (task = first_tid(leader, tid, pos - 2);
 	     task;
@@ -2579,7 +2579,7 @@ static int proc_task_readdir(struct file
 		if (proc_task_fill_cache(filp, dirent, filldir, task, tid) < 0) {
 			/* returning this tgid failed, save it as the first
 			 * pid for the next readir call */
-			filp->f_version = tid;
+			filp->f_version = (u64)tid;
 			put_task_struct(task);
 			break;
 		}
Index: linux-2.6-lttng/include/linux/seq_file.h
===================================================================
--- linux-2.6-lttng.orig/include/linux/seq_file.h	2007-08-18 11:12:39.000000000 -0400
+++ linux-2.6-lttng/include/linux/seq_file.h	2007-08-18 11:12:50.000000000 -0400
@@ -18,7 +18,7 @@ struct seq_file {
 	size_t from;
 	size_t count;
 	loff_t index;
-	loff_t version;
+	u64 version;
 	struct mutex lock;
 	const struct seq_operations *op;
 	void *private;

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

  parent reply	other threads:[~2007-08-18 16:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-12 15:08 [patch 0/2] Sorted seq_file Mathieu Desnoyers
2007-08-12 15:08 ` [patch 1/2] Seq_file add support for sorted list Mathieu Desnoyers
2007-08-12 15:08 ` [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators Mathieu Desnoyers
2007-08-15  3:39   ` Fengguang Wu
2007-08-15  3:39     ` Fengguang Wu
2007-08-15  4:18     ` Al Viro
2007-08-15  6:37       ` Fengguang Wu
2007-08-15  6:37         ` Fengguang Wu
2007-08-15  6:53         ` Al Viro
2007-08-15  8:36           ` Fengguang Wu
2007-08-15  8:36             ` Fengguang Wu
2007-08-15  8:46           ` Fengguang Wu
2007-08-15  8:46             ` Fengguang Wu
2007-08-18 15:56             ` Mathieu Desnoyers
2007-08-18 16:09             ` Mathieu Desnoyers [this message]
2007-08-24 15:39           ` [PATCH] Sort module list - use ppos instead of m->private Mathieu Desnoyers
2007-08-24 23:34             ` Andrew Morton
2007-08-25  0:05               ` Mathieu Desnoyers

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=20070818160906.GA22844@Krystal \
    --to=mathieu.desnoyers@polymtl.ca \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@google.com \
    --cc=rddunlap@osdl.org \
    --cc=viro@ftp.linux.org.uk \
    --cc=wfg@mail.ustc.edu.cn \
    /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.