summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2008-04-17udf: Fix handling of multisession mediaSebastian Manciulea
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 <manciuleas@yahoo.com> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: Mount filesystem read-only if it has pseudooverwrite partitionJan Kara
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 <jack@suse.cz>
2008-04-17udf: Handle VAT packed inside inode properlyJan Kara
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 <jack@suse.cz>
2008-04-17udf: Allow loading of VAT inodeJan Kara
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 <jack@suse.cz>
2008-04-17udf: Fix detection of VAT versionJan Kara
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 <jack@suse.cz>
2008-04-17udf: Silence warning about accesses beyond end of deviceJan Kara
Some of the computed positions of anchor block could be beyond the end of device. Skip reading such blocks. Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: Improve anchor block detectionJan Kara
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 <manciuleas@yahoo.com> claims this helps some drive + media combinations he is able to test. Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: Cleanup anchor block detection.Jan Kara
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 <jack@suse.cz>
2008-04-17udf: Move processing of virtual partitionsJan Kara
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 <jack@suse.cz>
2008-04-17udf: Move filling of partition descriptor info into a separate functionJan Kara
Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: Improve error recovery on mountJan Kara
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 <jack@suse.cz>
2008-04-17udf: Cleanup volume descriptor sequence processingJan Kara
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 <jack@suse.cz>
2008-04-17udf: fix anchor point detectionPavel Emelyanov
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 <Yuri.Per@acronis.com> Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Cc: Max Lyadvinsky <Max.Lyadvinsky@acronis.com> Cc: Vladimir Simonov <Vladimir.Simonov@acronis.com> Cc: Andrew Neporada <Andrew.Neporada@acronis.com> Cc: Kirill Korotaev <dev@openvz.org> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: Remove declarations of arrays of size UDF_NAME_LEN (256 bytes)Jan Kara
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 <jack@suse.cz>
2008-04-17udf: Remove checking of existence of filename in udf_add_entry()Jan Kara
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 <jack@suse.cz>
2008-04-17udf: Mark udf_process_sequence() as noinlineJan Kara
Mark udf_process_sequence() as noinline since stack usage is terrible otherwise. Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: super.c reorganizationMarcin Slusarz
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 <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: remove unneeded kernel_timestamp typeMarcin Slusarz
remove now unneeded kernel_timestamp type with conversion functions Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: convert udf_stamp_to_time and udf_time_to_stamp to use timestampsMarcin Slusarz
* 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 <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: convert udf_stamp_to_time to return struct timespecmarcin.slusarz@gmail.com
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: create function for conversion from timestamp to timespecmarcin.slusarz@gmail.com
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: udf_get_block, inode_bmap - remove unneeded checksmarcin.slusarz@gmail.com
block cannot be less than 0, because it's sector_t, so remove unneeded checks Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: convert udf_count_free_bitmap to use bitmap_weightMarcin Slusarz
replace handwritten bits counting with bitmap_weight Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: replace udf_*_offset macros with functionsmarcin.slusarz@gmail.com
- 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 <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: simplify __udf_read_inodemarcin.slusarz@gmail.com
- 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 <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: replace all adds to little endians variables with le*_add_cpumarcin.slusarz@gmail.com
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 <marcin.slusarz@gmail.com Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: truncate: create function for updating of Allocation Ext Descriptormarcin.slusarz@gmail.com
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Cc: Jan Kara <jack@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: simple cleanup of truncate.cmarcin.slusarz@gmail.com
- remove one indentation level by little code reorganization - convert "if (smth) BUG();" to "BUG_ON(smth);" Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: constify crcmarcin.slusarz@gmail.com
- constify internal crc table - mark udf_crc "in" parameter as const Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: udf_CS0toNLS cleanupmarcin.slusarz@gmail.com
- 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 <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: fix udf_build_ustrMarcin Slusarz
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 <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: udf_CS0toUTF8 cleanupmarcin.slusarz@gmail.com
- 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 <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17make udf_error() staticAdrian Bunk
This patch makes the needlessly global udf_error() static. Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17fs/udf: Use DIV_ROUND_UPJulia Lawall
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 <julia@diku.dk> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: move headers out include/linux/Christoph Hellwig
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 <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: kill useless file header comments for vfs method implementationsChristoph Hellwig
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 <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
2008-04-17udf: kill udf_set_blocksizeChristoph Hellwig
This helper has been quite useless since sb_min_blocksize was introduced and is misnamed while we're at it. Just opencode the few lines in the caller instead. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
2008-03-02Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6 * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6: firewire: fix crash in automatic module unloading firewire: potentially invalid pointers used in fw_card_bm_work firewire: fw-sbp2: better fix for NULL pointer dereference in scsi_remove_device
2008-03-02firewire: fix crash in automatic module unloadingStefan Richter
"modprobe firewire-ohci; sleep .1; modprobe -r firewire-ohci" used to result in crashes like this: BUG: unable to handle kernel paging request at ffffffff8807b455 IP: [<ffffffff8807b455>] PGD 203067 PUD 207063 PMD 7c170067 PTE 0 Oops: 0010 [1] PREEMPT SMP CPU 0 Modules linked in: i915 drm cpufreq_ondemand acpi_cpufreq freq_table applesmc input_polldev led_class coretemp hwmon eeprom snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss button thermal processor sg snd_hda_intel snd_pcm snd_timer snd snd_page_alloc sky2 i2c_i801 rtc [last unloaded: crc_itu_t] Pid: 9, comm: events/0 Not tainted 2.6.25-rc2 #3 RIP: 0010:[<ffffffff8807b455>] [<ffffffff8807b455>] RSP: 0018:ffff81007dcdde88 EFLAGS: 00010246 RAX: ffff81007dc95040 RBX: ffff81007dee5390 RCX: 0000000000005e13 RDX: 0000000000008c8b RSI: 0000000000000001 RDI: ffff81007dee5388 RBP: ffff81007dc5eb40 R08: 0000000000000002 R09: ffffffff8022d05c R10: ffffffff8023b34c R11: ffffffff8041a353 R12: ffff81007dee5388 R13: ffffffff8807b455 R14: ffffffff80593bc0 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffffffff8055a000(0000) knlGS:0000000000000000 CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b CR2: ffffffff8807b455 CR3: 0000000000201000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process events/0 (pid: 9, threadinfo ffff81007dcdc000, task ffff81007dc95040) Stack: ffffffff8023b396 ffffffff88082524 0000000000000000 ffffffff8807d9ae ffff81007dc5eb40 ffff81007dc9dce0 ffff81007dc5eb40 ffff81007dc5eb80 ffff81007dc9dce0 ffffffffffffffff ffffffff8023be87 0000000000000000 Call Trace: [<ffffffff8023b396>] ? run_workqueue+0xdf/0x1df [<ffffffff8023be87>] ? worker_thread+0xd8/0xe3 [<ffffffff8023e917>] ? autoremove_wake_function+0x0/0x2e [<ffffffff8023bdaf>] ? worker_thread+0x0/0xe3 [<ffffffff8023e813>] ? kthread+0x47/0x74 [<ffffffff804198e0>] ? trace_hardirqs_on_thunk+0x35/0x3a [<ffffffff8020c008>] ? child_rip+0xa/0x12 [<ffffffff8020b6e3>] ? restore_args+0x0/0x3d [<ffffffff8023e68a>] ? kthreadd+0x14c/0x171 [<ffffffff8023e68a>] ? kthreadd+0x14c/0x171 [<ffffffff8023e7cc>] ? kthread+0x0/0x74 [<ffffffff8020bffe>] ? child_rip+0x0/0x12 Code: Bad RIP value. RIP [<ffffffff8807b455>] RSP <ffff81007dcdde88> CR2: ffffffff8807b455 ---[ end trace c7366c6657fe5bed ]--- Note that this crash happened _after_ firewire-core was unloaded. The shared workqueue tried to run firewire-core's device initialization jobs or similar jobs. The fix makes sure that firewire-ohci and hence firewire-core is not unloaded before all device shutdown jobs have been completed. This is determined by the count of device initializations minus device releases. Also skip useless retries in the node initialization job if the node is to be shut down. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jarod Wilson <jwilson@redhat.com>
2008-03-02firewire: potentially invalid pointers used in fw_card_bm_workStefan Richter
The bus management workqueue job was in danger to dereference NULL pointers. Also, after having temporarily lifted card->lock, a few node pointers and a device pointer may have become invalid. Add NULL pointer checks and get the necessary references. Also, move card->local_node out of fw_card_bm_work's sight during shutdown of the card. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jarod Wilson <jwilson@redhat.com>
2008-03-02firewire: fw-sbp2: better fix for NULL pointer dereference in scsi_remove_deviceStefan Richter
Patch "firewire: fw-sbp2: fix NULL pointer deref. in scsi_remove_device" had the unintended effect that firewire-sbp2 could not be unloaded anymore until all SBP-2 devices were unplugged. We now fix the NULL pointer bug by reacquiring a reference to the sdev instead of holding a reference to the sdev (and to the module) all the time. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Tested-by: Jarod Wilson <jwilson@redhat.com>
2008-03-01[PATCH] drop EOE records from printkSteve Grubb
Hi, While we are looking at the printk issue, I see that its printk'ing the EOE (end of event) records which is really not something that we need in syslog. Its really intended for the realtime audit event stream handled by the audit daemon. So, lets avoid printk'ing that record type. Signed-off-by: Steve Grubb <sgrubb@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2008-03-01[RFC] AUDIT: do not panic when printk loses messagesEric Paris
On the latest kernels if one was to load about 15 rules, set the failure state to panic, and then run service auditd stop the kernel will panic. This is because auditd stops, then the script deletes all of the rules. These deletions are sent as audit messages out of the printk kernel interface which is already known to be lossy. These will overun the default kernel rate limiting (10 really fast messages) and will call audit_panic(). The same effect can happen if a slew of avc's come through while auditd is stopped. This can be fixed a number of ways but this patch fixes the problem by just not panicing if auditd is not running. We know printk is lossy and if the user chooses to set the failure mode to panic and tries to use printk we can't make any promises no matter how hard we try, so why try? At least in this way we continue to get lost message accounting and will eventually know that things went bad. The other change is to add a new call to audit_log_lost() if auditd disappears. We already pulled the skb off the queue and couldn't send it so that message is lost. At least this way we will account for the last message and panic if the machine is configured to panic. This code path should only be run if auditd dies for unforeseen reasons. If auditd closes correctly audit_pid will get set to 0 and we won't walk this code path. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2008-03-01[PATCH] Audit: Fix the format type for size_t variablesPaul Moore
Fix the following compiler warning by using "%zu" as defined in C99. CC kernel/auditsc.o kernel/auditsc.c: In function 'audit_log_single_execve_arg': kernel/auditsc.c:1074: warning: format '%ld' expects type 'long int', but argument 4 has type 'size_t' Signed-off-by: Paul Moore <paul.moore@hp.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2008-03-01Merge branch 'upstream-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev * 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: [libata] wrap kmap_atomic(KM_IRQ0) with local_irq_save/restore() sata_svw: Add support for HT1100 SATA controller
2008-03-01[libata] wrap kmap_atomic(KM_IRQ0) with local_irq_save/restore()Jeff Garzik
Interrupts must be disabled if using kmap_atomic(KM_IRQ0), but that was not the case in a few code paths coming directly from ATA driver interrupt handlers (which use spin_lock rather than spin_lock_irqsave). Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-02-29Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-armLinus Torvalds
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: [ARM] 4843/1: Add GCR_CLKBPB for PXA3xx [ARM] 4842/1: pxa: remove redundant IRQ saving/restoring in clk_pxa3xx_cken_* [ARM] 4841/1: pxa: fix typo in LCD platform data definition code for zylonite [ARM] 4840/1: pxa: fix the typo in get_irqnr_and_base [ARM] 4839/1: fixes kernel Oops in /dev/mem device driver for memory map with PHYS_OFF [ARM] eliminate MODULE_PARM() usage [ARM] 4838/1: Fix kexec for SA1100 machines [ARM] 4837/1: make __get_unaligned_*() return unsigned types [ARM] 4836/1: Make ATAGS_PROC depend on KEXEC
2008-02-29[ARM] 4843/1: Add GCR_CLKBPB for PXA3xxMark Brown
The PXA3xx AC97 controller has an additional control bit GCR_CLKBPB which must be used during cold reset. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: eric miao <eric.miao@marvell.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-02-29[ARM] 4842/1: pxa: remove redundant IRQ saving/restoring in clk_pxa3xx_cken_*eric miao
This is unnecessary since it is already protected by spin_lock_irq{save, restore} in clock.c. Signed-off-by: eric miao <eric.miao@marvell.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-02-29[ARM] 4841/1: pxa: fix typo in LCD platform data definition code for zyloniteeric miao
Signed-off-by: eric miao <eric.miao@marvell.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>