summaryrefslogtreecommitdiffstats
path: root/fs/udf/lowlevel.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf/lowlevel.c')
-rw-r--r--fs/udf/lowlevel.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/udf/lowlevel.c b/fs/udf/lowlevel.c
index 703843f30ff..1b88fd5df05 100644
--- a/fs/udf/lowlevel.c
+++ b/fs/udf/lowlevel.c
@@ -56,7 +56,12 @@ unsigned long udf_get_last_block(struct super_block *sb)
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)