diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2010-02-07 23:46:18 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2010-02-07 23:46:18 +0100 |
commit | 05367cedf498dfe9f061c5d9821a7f05eb501143 (patch) | |
tree | fa02380e392e2f6ad86bb4be8493bcf0b3ac20d4 /ext2fs | |
parent | 4c0c79dd946f481cda57c4f995a062b2387e4216 (diff) |
Fix ext2fs mount with sparse store
2010-02-06 Carl Fredrik Hammar <hammy.lite@gmail.com>
* ext2fs/storeinfo.c (diskfs_S_file_get_storage_info):
Return EOPNOTSUPP instead of store if file contains holes.
Diffstat (limited to 'ext2fs')
-rw-r--r-- | ext2fs/storeinfo.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/ext2fs/storeinfo.c b/ext2fs/storeinfo.c index 08b917f3..395ab5ca 100644 --- a/ext2fs/storeinfo.c +++ b/ext2fs/storeinfo.c @@ -63,19 +63,17 @@ diskfs_S_file_get_storage_info (struct protid *cred, err = ext2_getblk (node, index++, 0, &block); if (err == EINVAL) - /* Either a hole, or past the end of the file. */ - { - block = 0; - err = 0; - } - else if (err) + /* Either a hole, or past the end of the file. + A hole can't be mapped in runs since we don't know + where the blocks will be allocated, so we can't return the + underlying storage. */ + err = EOPNOTSUPP; + if (err) break; block <<= log2_dev_blocks_per_fs_block; if (num_runs == 0 - || ((block && run->start >= 0) /* Neither is a hole and... */ - ? (block != run->start + run->length) /* BLOCK doesn't follow RUN */ - : (block || run->start >= 0))) /* or one is, but not both */ + || block != run->start + run->length) /* BLOCK doesn't follow RUN */ /* Add a new run. */ { if (num_runs == runs_alloced) @@ -93,8 +91,7 @@ diskfs_S_file_get_storage_info (struct protid *cred, } run = runs + num_runs++; - /* -1 means a hole in OFFSETS. */ - run->start = block ?: (store_offset_t) -1; + run->start = block; /* The length will get extended just below. */ run->length = 0; } |