[PATCH 1/1] ext4, dio: Remove overflow for size >2G in aio-dio code.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




From: Manish Honap <manish_honap_vit@xxxxxxxxxxx>

The direct-io.c::do_direct_io() returns int and  this causes the results to
overflow for sizes>=2g; the following patch removes this bug.
Signed-off-by: Manish Honap <manish_honap_vit@xxxxxxxxxxx>


---

Kernel version - linux-3.3.4
linux-3.3.4/fs/direct-io.c  |    6 +++---
linux-3.3.4/fs/ext4/file.c  |    2 +-
linux-3.3.4/fs/ext4/inode.c |    2 +-
3 files changed, 5 insertions(+), 5 deletions(-)

diff -uprN -X linux-3.3.4-vanilla/Documentation/dontdiff linux-3.3.4-vanilla/fs/direct-io.c ../linux-3.3.4/fs/direct-io.c
--- linux-3.3.4-vanilla/fs/direct-io.c    2012-04-27 22:47:35.000000000 +0530
+++ ../linux-3.3.4/fs/direct-io.c    2012-05-20 10:34:47.885599682 +0530
@@ -892,14 +892,14 @@ static inline void dio_zero_block(struct
  * it should set b_size to PAGE_SIZE or more inside get_block().  This gives
  * fine alignment but still allows this function to work in PAGE_SIZE units.
  */
-static int do_direct_IO(struct dio *dio, struct dio_submit *sdio,
-            struct buffer_head *map_bh)
+static ssize_t do_direct_IO(struct dio *dio, struct dio_submit *sdio,
+                struct buffer_head *map_bh)
{
    const unsigned blkbits = sdio->blkbits;
    const unsigned blocks_per_page = PAGE_SIZE >> blkbits;
    struct page *page;
    unsigned block_in_page;
-    int ret = 0;
+    ssize_t ret = 0;

    /* The I/O can start at any block offset within the first page */
    block_in_page = sdio->first_block_in_page;
diff -uprN -X linux-3.3.4-vanilla/Documentation/dontdiff linux-3.3.4-vanilla/fs/ext4/file.c ../linux-3.3.4/fs/ext4/file.c
--- linux-3.3.4-vanilla/fs/ext4/file.c    2012-04-27 22:47:35.000000000 +0530
+++ ../linux-3.3.4/fs/ext4/file.c    2012-05-20 10:29:02.714603023 +0530
@@ -95,7 +95,7 @@ ext4_file_write(struct kiocb *iocb, cons
{
    struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
    int unaligned_aio = 0;
-    int ret;
+    ssize_t ret;

    /*
     * If we have encountered a bitmap-format file, the size limit
diff -uprN -X linux-3.3.4-vanilla/Documentation/dontdiff linux-3.3.4-vanilla/fs/ext4/inode.c ../linux-3.3.4/fs/ext4/inode.c
--- linux-3.3.4-vanilla/fs/ext4/inode.c    2012-04-27 22:47:35.000000000 +0530
+++ ../linux-3.3.4/fs/ext4/inode.c    2012-05-20 10:30:15.444622201 +0530
@@ -2750,7 +2750,7 @@ static int ext4_get_block_write(struct i
}

static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
-                ssize_t size, void *private, int ret,
+                ssize_t size, void *private, ssize_t ret,
                bool is_async)
{
    struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;


Thanks & Regards,
- Manish 
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux