[PATCH 1/5] fuse: request counter overflow fix

From: Miklos Szeredi
Date: Fri Jul 29 2005 - 05:56:19 EST


This patch fixes a signed/unsigned comparison bug found by Franco Broi
after months of filesystem uptime and 2,147,483,648 performed fs
operations.

Since the request identifier is already 64 bits on the userspace ABI,
the counter is now made 64-bit too.

Signed-off-by: Miklos Szeredi <miklos@xxxxxxxxxx>

diff -rup linux-2.6.13-rc3-mm1/fs/fuse/dev.c linux-fuse/fs/fuse/dev.c
--- linux-2.6.13-rc3-mm1/fs/fuse/dev.c 2005-07-27 09:23:53.000000000 +0200
+++ linux-fuse/fs/fuse/dev.c 2005-07-27 09:29:01.000000000 +0200
@@ -669,7 +671,7 @@ static ssize_t fuse_dev_read(struct file
}

/* Look up request on processing list by unique ID */
-static struct fuse_req *request_find(struct fuse_conn *fc, unsigned unique)
+static struct fuse_req *request_find(struct fuse_conn *fc, u64 unique)
{
struct list_head *entry;

diff -rup linux-2.6.13-rc3-mm1/fs/fuse/fuse_i.h linux-fuse/fs/fuse/fuse_i.h
--- linux-2.6.13-rc3-mm1/fs/fuse/fuse_i.h 2005-07-27 09:23:53.000000000 +0200
+++ linux-fuse/fs/fuse/fuse_i.h 2005-07-27 09:29:01.000000000 +0200
@@ -240,7 +240,7 @@ struct fuse_conn {
struct list_head unused_list;

/** The next unique request id */
- int reqctr;
+ u64 reqctr;

/** Mount is active */
unsigned mounted : 1;
diff -rup linux-2.6.13-rc3-mm1/fs/fuse/inode.c linux-fuse/fs/fuse/inode.c
--- linux-2.6.13-rc3-mm1/fs/fuse/inode.c 2005-07-27 09:23:53.000000000 +0200
+++ linux-fuse/fs/fuse/inode.c 2005-07-27 09:29:01.000000000 +0200
@@ -407,7 +417,7 @@ static struct fuse_conn *new_conn(void)
}
fc->bdi.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE;
fc->bdi.unplug_io_fn = default_unplug_io_fn;
- fc->reqctr = 1;
+ fc->reqctr = 0;
}
return fc;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/