Whamcloud - gitweb
b=6243
authorgreen <green>
Thu, 5 May 2005 05:55:08 +0000 (05:55 +0000)
committergreen <green>
Thu, 5 May 2005 05:55:08 +0000 (05:55 +0000)
r=adilger

Correctly return zero-filled regions when doing reads of files with no objects.
Export clear_user_tt symbol in UML as it is now needed by lustre.

lustre/ChangeLog
lustre/kernel_patches/patches/uml-exprt-clearuser.patch [new file with mode: 0644]
lustre/kernel_patches/series/2.6-suse-lnxi.series
lustre/kernel_patches/series/vanilla-2.4.24
lustre/kernel_patches/series/vanilla-2.4.29
lustre/llite/file.c

index 2609f03..7a76182 100644 (file)
@@ -28,6 +28,7 @@ tbd         Cluster File Systems, Inc. <info@clusterfs.com>
        - ldlm_enqueue freed-export error path would always LBUG (6149,6184)
        - don't reference lr_lvb_data until after we hold lr_lvb_sem (6170)
        - don't overwrite last_rcvd if there is a *_client_add() error (6068)
+       - Correctly handle reads of files with no objects (6243)
        * miscellania
        - by default create 1 inode per 4kB space on MDS, per 16kB on OSTs
        - allow --write-conf on an MDS with different nettype than client (5619)
diff --git a/lustre/kernel_patches/patches/uml-exprt-clearuser.patch b/lustre/kernel_patches/patches/uml-exprt-clearuser.patch
new file mode 100644 (file)
index 0000000..e6ffa56
--- /dev/null
@@ -0,0 +1,10 @@
+--- uml-2.4.24/arch/um/kernel/tt/ksyms.c.orig  2005-05-04 13:59:58.806659456 +0300
++++ uml-2.4.24/arch/um/kernel/tt/ksyms.c       2005-05-04 14:00:18.358687096 +0300
+@@ -12,6 +12,7 @@
+ EXPORT_SYMBOL(__do_strncpy_from_user);
+ EXPORT_SYMBOL(__do_strnlen_user); 
+ EXPORT_SYMBOL(__do_clear_user);
++EXPORT_SYMBOL(clear_user_tt);
+ EXPORT_SYMBOL(tracing_pid);
+ EXPORT_SYMBOL(honeypot);
index 59c9be2..3c6de43 100644 (file)
@@ -9,3 +9,4 @@ export-filemap_populate.patch
 grab_cache_page_nowait_gfp-2.6-suse.patch 
 remove-suid-2.6-suse.patch
 link_notlast-susefix.patch
+uml-exprt-clearuser.patch
index 9d16d81..cba0f22 100644 (file)
@@ -43,3 +43,4 @@ export-show_task-2.4-vanilla.patch
 export-zap-page-range.patch
 uml-sigusr1-2.4-vanilla.patch 
 remove-suid-2.4-rhel.patch
+uml-exprt-clearuser.patch
index 53a248c..0780a65 100644 (file)
@@ -1,6 +1,7 @@
 uml-patch-2.4.29-1.patch
 uml-2.4.20-do_mmap_pgoff-fix.patch
 uml-export-end_iomem.patch
+uml-exprt-clearuser.patch
 configurable-x86-stack-2.4.20.patch
 configurable-x86_64-2.4.21.patch
 dev_read_only_2.4.20-rh.patch
index 66fdd1e..2d7e572 100644 (file)
@@ -775,8 +775,26 @@ static ssize_t ll_file_read(struct file *filp, char *buf, size_t count,
         lprocfs_counter_add(ll_i2sbi(inode)->ll_stats, LPROC_LL_READ_BYTES,
                             count);
 
-        if (!lsm)
-                RETURN(0);
+        if (!lsm) {
+                /* Read on file with no objects should return zero-filled
+                 * buffers up to file size (we can get non-zero sizes with
+                 * mknod + truncate, then opening file for read. This is a
+                 * common pattern in NFS case, it seems). Bug 6243 */
+                int notzeroed;
+                /* Since there are no objects on OSTs, we have nothing to get
+                 * lock on and so we are forced to access inode->i_size
+                 * unguarded */
+                if (count > inode->i_size - *ppos)
+                        count = inode->i_size - *ppos;
+                /* Make sure to correctly adjust the file pos pointer for
+                 * EFAULT case */
+                notzeroed = clear_user(buf, count);
+                count -= notzeroed;
+                *ppos += count;
+                if (!count)
+                        RETURN(-EFAULT);
+                RETURN(count);
+        }
         
         node = ll_node_from_inode(inode, *ppos, *ppos  + count - 1, 
                                   LCK_PR);