aboutsummaryrefslogtreecommitdiff
path: root/fs/udf
AgeCommit message (Collapse)AuthorFilesLines
2008-08-19udf: Fix lock inversion between iprune_mutex and alloc_mutex (v2)Jan Kara1-2/+1
A memory allocation inside alloc_mutex must not recurse back into the filesystem itself because that leads to lock inversion between iprune_mutex and alloc_mutex (and thus to deadlocks - see traces below). alloc_mutex is actually needed only to update allocation statistics in the superblock so we can drop it before we start allocating memory for the inode. tar D ffff81015b9c8c90 0 6614 6612 ffff8100d5a21a20 0000000000000086 0000000000000000 00000000ffff0000 ffff81015b9c8c90 ffff81015b8f0cd0 ffff81015b9c8ee0 0000000000000000 0000000000000003 0000000000000000 0000000000000000 0000000000000000 Call Trace: [<ffffffff803c1d8a>] __mutex_lock_slowpath+0x64/0x9b [<ffffffff803c1bef>] mutex_lock+0xa/0xb [<ffffffff8027f8c2>] shrink_icache_memory+0x38/0x200 [<ffffffff80257742>] shrink_slab+0xe3/0x15b [<ffffffff802579db>] try_to_free_pages+0x221/0x30d [<ffffffff8025657e>] isolate_pages_global+0x0/0x31 [<ffffffff8025324b>] __alloc_pages_internal+0x252/0x3ab [<ffffffff8026b08b>] cache_alloc_refill+0x22e/0x47b [<ffffffff8026ae37>] kmem_cache_alloc+0x3b/0x61 [<ffffffff8026b15b>] cache_alloc_refill+0x2fe/0x47b [<ffffffff8026b34e>] __kmalloc+0x76/0x9c [<ffffffffa00751f2>] :udf:udf_new_inode+0x202/0x2e2 [<ffffffffa007ae5e>] :udf:udf_create+0x2f/0x16d [<ffffffffa0078f27>] :udf:udf_lookup+0xa6/0xad ... kswapd0 D ffff81015b9d9270 0 125 2 ffff81015b903c28 0000000000000046 ffffffff8028cbb0 00000000fffffffb ffff81015b9d9270 ffff81015b8f0cd0 ffff81015b9d94c0 000000000271b490 ffffe2000271b458 ffffe2000271b420 ffffe20002728dc8 ffffe20002728d90 Call Trace: [<ffffffff8028cbb0>] __set_page_dirty+0xeb/0xf5 [<ffffffff8025403a>] get_dirty_limits+0x1d/0x22f [<ffffffff803c1d8a>] __mutex_lock_slowpath+0x64/0x9b [<ffffffff803c1bef>] mutex_lock+0xa/0xb [<ffffffffa0073f58>] :udf:udf_bitmap_free_blocks+0x47/0x1eb [<ffffffffa007df31>] :udf:udf_discard_prealloc+0xc6/0x172 [<ffffffffa007875a>] :udf:udf_clear_inode+0x1e/0x48 [<ffffffff8027f121>] clear_inode+0x6d/0xc4 [<ffffffff8027f7f2>] dispose_list+0x56/0xee [<ffffffff8027fa5a>] shrink_icache_memory+0x1d0/0x200 [<ffffffff80257742>] shrink_slab+0xe3/0x15b [<ffffffff80257e93>] kswapd+0x346/0x447 ... Reported-by: Tibor Tajti <[email protected]> Reviewed-by: Ingo Oeser <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-07-26SL*B: drop kmem cache argument from constructorAlexey Dobriyan1-1/+1
Kmem cache passed to constructor is only needed for constructors that are themselves multiplexeres. Nobody uses this "feature", nor does anybody uses passed kmem cache in non-trivial way, so pass only pointer to object. Non-trivial places are: arch/powerpc/mm/init_64.c arch/powerpc/mm/hugetlbpage.c This is flag day, yes. Signed-off-by: Alexey Dobriyan <[email protected]> Acked-by: Pekka Enberg <[email protected]> Acked-by: Christoph Lameter <[email protected]> Cc: Jon Tollefson <[email protected]> Cc: Nick Piggin <[email protected]> Cc: Matt Mackall <[email protected]> [[email protected]: fix arch/powerpc/mm/hugetlbpage.c] [[email protected]: fix mm/slab.c] [[email protected]: fix ubifs] Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-06-24udf: Fix regression in UDF anchor block detectionTomas Janousek1-34/+23
In some cases it could happen that some block passed test in udf_check_anchor_block() even though udf_read_tagged() refused to read it later (e.g. because checksum was not correct). This patch makes udf_check_anchor_block() use udf_read_tagged() so that the checking is stricter. This fixes the regression (certain disks unmountable) caused by commit 423cf6dc04eb79d441bfda2b127bc4b57134b41d. Signed-off-by: Tomas Janousek <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-06-16udf: restore UDFFS_DEBUG to being undefined by defaultPaul Collins1-1/+1
Commit 706047a79725b585cf272fdefc234b31b6545c72, "udf: Fix compilation warnings when UDF debug is on" inadvertently (I assume) enabled debugging messages by default for UDF. This patch disables them again. Signed-off-by: Paul Collins <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-05-08Merge branch 'for_linus' of ↵Linus Torvalds4-6/+145
git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-udf-2.6 * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-udf-2.6: udf: Fix memory corruption when fs mounted with noadinicb option udf: Make udf exportable udf: fs/udf/partition.c:udf_get_pblock() mustn't be inline
2008-05-07udf: Fix memory corruption when fs mounted with noadinicb optionJan Kara1-2/+3
When UDF filesystem is mounted with noadinicb mount option, it happens that we extend an empty directory with a block. A code in udf_add_entry() didn't count with this possibility and used uninitialized data leading to memory and filesystem corruption. Add a check whether file already has some extents before operating on them. Signed-off-by: Jan Kara <[email protected]>
2008-05-07udf: Make udf exportableRasmus Rohde3-2/+140
Cc: Christoph Hellwig <[email protected]> Signed-off-by: Rasmus Rohde <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-30fs: replace remaining __FUNCTION__ occurrencesHarvey Harrison1-2/+2
__FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-04-28udf: fs/udf/partition.c:udf_get_pblock() mustn't be inlineAdrian Bunk1-2/+2
This patch fixes the following build error with UML and gcc 4.3: <-- snip --> ... CC fs/udf/partition.o /home/bunk/linux/kernel-2.6/git/linux-2.6/fs/udf/partition.c: In function ‘udf_get_pblock_virt15’: /home/bunk/linux/kernel-2.6/git/linux-2.6/fs/udf/partition.c:32: sorry, unimplemented: inlining failed in call to ‘udf_get_pblock’: function body not available /home/bunk/linux/kernel-2.6/git/linux-2.6/fs/udf/partition.c:102: sorry, unimplemented: called from here make[3]: *** [fs/udf/partition.o] Error 1 <-- snip --> Signed-off-by: Adrian Bunk <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-28udf: fix sparse warning in namei.cHarvey Harrison1-4/+4
Let's use bsize instead. fs/udf/namei.c:960:12: warning: symbol 'elen' shadows an earlier one fs/udf/namei.c:937:15: originally declared here Signed-off-by: Harvey Harrison <[email protected]> Cc: Jan Kara <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-04-17udf: use crc_itu_t from lib instead of udf_crcBob Copeland8-203/+31
As pointed out by Sergey Vlasov, UDF implements its own version of the CRC ITU-T V.41. Convert it to use the one in the library. Signed-off-by: Bob Copeland <[email protected]> Cc: Sergey Vlasov <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Fix compilation warnings when UDF debug is onSebastian Manciulea2-4/+5
Fix two compilation warnings (and actual bugs in message formatting) when UDF debugging is turned on. Signed-off-by: Sebastian Manciulea <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Fix bug in VAT mapping codeSebastian Manciulea2-5/+4
Fix mapping of blocks using VAT when it is stored in an inode. UDF_I(inode)->i_data already points to the beginning of VAT header so there's no need to add udf_ext0_offset(inode). Signed-off-by: Sebastian Manciulea <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Add read-only support for 2.50 UDF mediaJan Kara5-14/+258
This patch implements parsing of metadata partitions and reading of Metadata File thus allowing to read UDF 2.50 media. Error resilience is implemented through accessing the Metadata Mirror File in case the data the Metadata File cannot be read. The patch is based on the original patch by Sebastian Manciulea <[email protected]> and Mircea Fedoreanu <[email protected]>. Signed-off-by: Sebastian Manciulea <[email protected]> Signed-off-by: Mircea Fedoreanu <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Fix handling of multisession mediaSebastian Manciulea2-9/+6
According to OSTA UDF specification, only anchor blocks and primary volume descriptors are placed on media relative to the last session. All other block numbers are absolute (in the partition or the whole media). This seems to be confirmed by multisession media created by other systems. Signed-off-by: Sebastian Manciulea <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Mount filesystem read-only if it has pseudooverwrite partitionJan Kara1-0/+8
As we don't properly support writing to pseudooverwrite partition (we should add entries to VAT and relocate blocks instead of just writing them), mount filesystems with such partition as read-only. Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Handle VAT packed inside inode properlyJan Kara2-12/+22
We didn't handle VAT packed inside the inode - we tried to call udf_block_map() on such file which lead to strange results at best. Add proper handling of packed VAT as we do it with other packed files. Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Allow loading of VAT inodeJan Kara1-0/+1
UDF media with VAT could have never worked because udf_fill_inode() didn't know about case FILE_TYPE_VAT20. Fix this. Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Fix detection of VAT versionJan Kara1-2/+2
We incorrectly (way to strictly) checked version of VAT on loading and thus refuse to mount correct media. There are just two format versions - below 2.0 and above 2.0 and we understand both. So update the version check accordingly. Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Silence warning about accesses beyond end of deviceJan Kara1-1/+5
Some of the computed positions of anchor block could be beyond the end of device. Skip reading such blocks. Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Improve anchor block detectionJan Kara1-4/+9
Add <last block>+1 and <last block>-1 to a list of blocks which can be the real last recorded block on a UDF media. Sebastian Manciulea <[email protected]> claims this helps some drive + media combinations he is able to test. Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Cleanup anchor block detection.Jan Kara2-142/+99
UDF anchor block detection is complicated by several things - there are several places where the anchor point can be, some of them relative to the last recorded block which some devices report wrongly. Moreover some devices on some media seem to have 7 spare blocks sectors for every 32 blocks (at least as far as I understand the old code) so we have to count also with that possibility. This patch splits anchor block detection into several functions so that it is clearer what we actually try to do. We fix several bugs of the type "for such and such media, we fail to check block blah" as a result of the cleanup. Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Move processing of virtual partitionsJan Kara1-80/+85
This patch move processing of UDF virtual partitions close to the place where other partition types are processed. As a result we now also properly fill in partition access type. Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Move filling of partition descriptor info into a separate functionJan Kara1-56/+62
Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Improve error recovery on mountJan Kara1-44/+42
Report error when we fail to allocate memory for a bitmap and properly release allocated memory and inodes for all the partitions in case of mount failure and umount. Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Cleanup volume descriptor sequence processingJan Kara1-54/+81
Cleanup processing of volume descriptor sequence so that it is more readable, make code handle errors (e.g. media problems) better. Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: fix anchor point detectionPavel Emelyanov1-9/+6
According to ECMA 167 rev. 3 (see 3/8.4.2.1), Anchor Volume Descriptor Pointer should be recorded at two or more anchor points located at sectors 256, N, N - 256, where N - is a largest logical sector number at volume space. So we should always try to detect N on UDF volume before trying to find Anchor Volume Descriptor (i.e. calling to udf_find_anchor()). That said, all this patch does is updates the s_last_block even if the udf_vrs() returns positive value. Originally written and tested by Yuri Per, ported on latest mainline by me. Signed-off-by: Yuri Per <[email protected]> Signed-off-by: Pavel Emelyanov <[email protected]> Cc: Max Lyadvinsky <[email protected]> Cc: Vladimir Simonov <[email protected]> Cc: Andrew Neporada <[email protected]> Cc: Kirill Korotaev <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Remove declarations of arrays of size UDF_NAME_LEN (256 bytes)Jan Kara2-92/+93
There are several places in UDF where we declared temporary arrays of UDF_NAME_LEN bytes on stack. This is not nice to stack usage so this patch changes those places to use kmalloc() instead. Also clean up bail-out paths in those functions when we are changing them. Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Remove checking of existence of filename in udf_add_entry()Jan Kara1-37/+1
We don't have to check whether a directory entry already exists in a directory when creating a new one since we've already checked that earlier by lookup and we are holding directory i_mutex all the time. Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: Mark udf_process_sequence() as noinlineJan Kara1-1/+1
Mark udf_process_sequence() as noinline since stack usage is terrible otherwise. Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: super.c reorganizationMarcin Slusarz1-282/+270
reorganize few code blocks in super.c which were needlessly indented (and hard to read): so change from: rettype fun() { init; if (sth) { long block of code; } } to: rettype fun() { init; if (!sth) return; long block of code; } or from: rettype fun2() { init; while (sth) { init2(); if (sth2) { long block of code; } } } to: rettype fun2() { init; while (sth) { init2(); if (!sth2) continue; long block of code; } } Signed-off-by: Marcin Slusarz <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: remove unneeded kernel_timestamp typeMarcin Slusarz3-39/+5
remove now unneeded kernel_timestamp type with conversion functions Signed-off-by: Marcin Slusarz <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: convert udf_stamp_to_time and udf_time_to_stamp to use timestampsMarcin Slusarz4-53/+41
* kernel_timestamp type was almost unused - only callers of udf_stamp_to_time and udf_time_to_stamp used it, so let these functions handle endianness internally and don't clutter code with conversions * rename udf_stamp_to_time to udf_disk_stamp_to_time and udf_time_to_stamp to udf_time_to_disk_stamp Signed-off-by: Marcin Slusarz <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: convert udf_stamp_to_time to return struct timespec[email protected]4-42/+37
Signed-off-by: Marcin Slusarz <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: create function for conversion from timestamp to timespec[email protected]1-56/+23
Signed-off-by: Marcin Slusarz <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: udf_get_block, inode_bmap - remove unneeded checks[email protected]1-12/+0
block cannot be less than 0, because it's sector_t, so remove unneeded checks Signed-off-by: Marcin Slusarz <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: convert udf_count_free_bitmap to use bitmap_weightMarcin Slusarz1-12/+5
replace handwritten bits counting with bitmap_weight Signed-off-by: Marcin Slusarz <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: replace udf_*_offset macros with functions[email protected]2-12/+21
- translate udf_file_entry_alloc_offset macro into function - translate udf_ext0_offset macro into function - add comment about crypticly named fields in struct udf_inode_info Signed-off-by: Marcin Slusarz <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: simplify __udf_read_inode[email protected]1-29/+23
- move all brelse(ibh) after main if, because it's called on every path except one where ibh is null - move variables to the most inner blocks Signed-off-by: Marcin Slusarz <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: replace all adds to little endians variables with le*_add_cpu[email protected]3-29/+12
replace all: little_endian_variable = cpu_to_leX(leX_to_cpu(little_endian_variable) + expression_in_cpu_byteorder); with: leX_add_cpu(&little_endian_variable, expression_in_cpu_byteorder); sparse didn't generate any new warning with this patch Signed-off-by: Marcin Slusarz <[email protected] Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: truncate: create function for updating of Allocation Ext Descriptor[email protected]1-33/+23
Signed-off-by: Marcin Slusarz <[email protected]> Cc: Jan Kara <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: simple cleanup of truncate.c[email protected]1-42/+34
- remove one indentation level by little code reorganization - convert "if (smth) BUG();" to "BUG_ON(smth);" Signed-off-by: Marcin Slusarz <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: constify crc[email protected]2-3/+3
- constify internal crc table - mark udf_crc "in" parameter as const Signed-off-by: Marcin Slusarz <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: udf_CS0toNLS cleanup[email protected]1-11/+8
- fix error handling - always zero output variable - don't zero explicitely fields zeroed by memset - mark "in" paramater as const Signed-off-by: Marcin Slusarz <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: fix udf_build_ustrMarcin Slusarz1-5/+7
udf_build_ustr was broken: - size == 1: dest->u_len = ptr[1 - 1], but at ptr[0] there's cmpID, so we created string with wrong length it should not happen, so we BUG() it - size > 1 and size < UDF_NAME_LEN: we set u_len correctly, but memcpy copied one needless byte - size == UDF_NAME_LEN - 1: memcpy overwrited u_len - with correct value, but... - size >= UDF_NAME_LEN: we copied UDF_NAME_LEN - 1 bytes, but dest->u_name is array of UDF_NAME_LEN - 2 bytes, so we were overwriting u_len with character from input string nobody noticed because all callers set size to acceptable values (constants within range) Signed-off-by: Marcin Slusarz <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: udf_CS0toUTF8 cleanup[email protected]2-18/+11
- fix error handling - always zero output variable - don't zero explicitely fields zeroed by memset - mark "in" paramater as const - remove outdated comment Signed-off-by: Marcin Slusarz <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17make udf_error() staticAdrian Bunk2-3/+4
This patch makes the needlessly global udf_error() static. Signed-off-by: Adrian Bunk <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17fs/udf: Use DIV_ROUND_UPJulia Lawall1-4/+3
The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) / (d)) but is perhaps more readable. An extract of the semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @haskernel@ @@ #include <linux/kernel.h> @depends on haskernel@ expression n,d; @@ ( - (n + d - 1) / d + DIV_ROUND_UP(n,d) | - (n + (d - 1)) / d + DIV_ROUND_UP(n,d) ) @depends on haskernel@ expression n,d; @@ - DIV_ROUND_UP((n),d) + DIV_ROUND_UP(n,d) @depends on haskernel@ expression n,d; @@ - DIV_ROUND_UP(n,(d)) + DIV_ROUND_UP(n,d) // </smpl> Signed-off-by: Julia Lawall <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: move headers out include/linux/Christoph Hellwig12-16/+141
There's really no reason to keep udf headers in include/linux as they're not used by anything but fs/udf/. This patch merges most of include/linux/udf_fs_i.h into fs/udf/udf_i.h, include/linux/udf_fs_sb.h into fs/udf/udf_sb.h and include/linux/udf_fs.h into fs/udf/udfdecl.h. The only thing remaining in include/linux/ is a stub of udf_fs_i.h defining the four user-visible udf ioctls. It's also moved from unifdef-y to headers-y because it can be included unconditionally now. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2008-04-17udf: kill useless file header comments for vfs method implementationsChristoph Hellwig5-178/+1
There's not need to document vfs method invocation rules, we have Documentation/filesystems/vfs.txt and Documentation/filesystems/Locking for that. Also a lot of these comments where either plain wrong or horrible out of date. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jan Kara <[email protected]>