Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b47c361 authored by Mathieu Desnoyers's avatar Mathieu Desnoyers Committed by Linus Torvalds
Browse files

Fix f_version type: should be u64 instead of unsigned long



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: default avatarMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Martin Bligh <mbligh@google.com>
Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
Cc: Al Viro <viro@ftp.linux.org.uk>
Cc: <linux-ext4@vger.kernel.org>
Cc: Mark Fasheh <mark.fasheh@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 41d10da3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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,
+1 −1
Original line number Diff line number Diff line
@@ -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,
+5 −5
Original line number Diff line number Diff line
@@ -586,7 +586,7 @@ bail:
}

static int ocfs2_dir_foreach_blk_id(struct inode *inode,
				    unsigned long *f_version,
				    u64 *f_version,
				    loff_t *f_pos, void *priv,
				    filldir_t filldir, int *filldir_err)
{
@@ -648,7 +648,7 @@ revalidate:
			 * not the directory has been modified
			 * during the copy operation.
			 */
			unsigned long version = *f_version;
			u64 version = *f_version;
			unsigned char d_type = DT_UNKNOWN;

			if (de->file_type < OCFS2_FT_MAX)
@@ -677,7 +677,7 @@ out:
}

static int ocfs2_dir_foreach_blk_el(struct inode *inode,
				    unsigned long *f_version,
				    u64 *f_version,
				    loff_t *f_pos, void *priv,
				    filldir_t filldir, int *filldir_err)
{
@@ -798,7 +798,7 @@ out:
	return stored;
}

static int ocfs2_dir_foreach_blk(struct inode *inode, unsigned long *f_version,
static int ocfs2_dir_foreach_blk(struct inode *inode, u64 *f_version,
				 loff_t *f_pos, void *priv, filldir_t filldir,
				 int *filldir_err)
{
@@ -818,7 +818,7 @@ int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv,
		      filldir_t filldir)
{
	int ret = 0, filldir_err = 0;
	unsigned long version = inode->i_version;
	u64 version = inode->i_version;

	while (*f_pos < i_size_read(inode)) {
		ret = ocfs2_dir_foreach_blk(inode, &version, f_pos, priv,
+2 −2
Original line number Diff line number Diff line
@@ -2586,7 +2586,7 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi
	/* 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;
@@ -2595,7 +2595,7 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi
		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;
		}
+1 −1
Original line number Diff line number Diff line
@@ -792,7 +792,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
Loading