]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/patches/suse-2.6.27.31/patches.fixes/udf-last_block_fix.patch
Move xen patchset to new version's subdir.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.fixes / udf-last_block_fix.patch
diff --git a/src/patches/suse-2.6.27.31/patches.fixes/udf-last_block_fix.patch b/src/patches/suse-2.6.27.31/patches.fixes/udf-last_block_fix.patch
new file mode 100644 (file)
index 0000000..e929601
--- /dev/null
@@ -0,0 +1,28 @@
+From: Jan Kara <jack@suse.cz>
+Subject: udf: Use device size when drive reported bogus number of written blocks
+References: bnc#501663
+Patch-mainline: 2.6.31
+
+Some drives report 0 as the number of written blocks when there are some blocks
+recorded. Use device size in such case so that we can automagically mount such
+media.
+
+Signed-off-by: Jan Kara <jack@suse.cz>
+
+diff -rupX /home/jack/.kerndiffexclude linux-2.6.27-SLE11_BRANCH/fs/udf/lowlevel.c linux-2.6.27-SLE11_BRANCH-1-udf_last_block_fix//fs/udf/lowlevel.c
+--- linux-2.6.27-SLE11_BRANCH/fs/udf/lowlevel.c        2008-10-10 00:13:53.000000000 +0200
++++ linux-2.6.27-SLE11_BRANCH-1-udf_last_block_fix//fs/udf/lowlevel.c  2009-06-18 12:08:11.000000000 +0200
+@@ -56,7 +56,12 @@ unsigned long udf_get_last_block(struct
+       struct block_device *bdev = sb->s_bdev;
+       unsigned long lblock = 0;
+-      if (ioctl_by_bdev(bdev, CDROM_LAST_WRITTEN, (unsigned long) &lblock))
++      /*
++       * ioctl failed or returned obviously bogus value?
++       * Try using the device size...
++       */
++      if (ioctl_by_bdev(bdev, CDROM_LAST_WRITTEN, (unsigned long) &lblock) ||
++          lblock == 0)
+               lblock = bdev->bd_inode->i_size >> sb->s_blocksize_bits;
+       if (lblock)