Commit graph

2756 commits

Author SHA1 Message Date
Nathan Scott 6fe90e6d14 [XFS] Remove an incorrect use of unlikely() on a relatively likely code
path.

SGI-PV: 904196
SGI-Modid: xfs-linux-melb:xfs-kern:26249a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-19 08:40:12 +10:00
Nathan Scott 1e69dd0eb3 [XFS] Push some common code out of write path into core XFS code for
sharing.

SGI-PV: 904196
SGI-Modid: xfs-linux-melb:xfs-kern:26248a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-19 08:39:53 +10:00
Nathan Scott 1d47bec290 [XFS] Remove unnecessary local from open_exec dmapi path.
SGI-PV: 904196
SGI-Modid: xfs-linux-melb:xfs-kern:26247a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-19 08:39:16 +10:00
David Woodhouse 1046d88001 [JFFS2] Check CRC32 on dirent and data nodes each time they're read
Also, make sure dirents are marked REF_UNCHECKED when we 'discover' them
through eraseblock summary.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-18 22:44:21 +01:00
David Woodhouse fc6612f627 [JFFS2] When retiring nextblock, allocate a node_ref for the wasted space
Failing to do so makes the calculated length of the last node incorrect,
when we're not using eraseblock summaries.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-18 18:39:38 +01:00
David Woodhouse 2ba72cb754 [JFFS2] Mark XATTR support as experimental, for now
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-18 10:22:40 +01:00
David Woodhouse 3877f0b6c9 [JFFS2] Don't trust node headers before the CRC is checked.
Especially when summary code is used, we can have in-memory data
structures referencing certain nodes without them actually being readable
on the flash. Discard the nodes gracefully in that case, rather than
triggering a BUG().

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-18 00:05:26 +01:00
Jens Axboe 991721572e [PATCH] Fix missing ret assignment in __bio_map_user() error path
If get_user_pages() returns less pages than what we asked for, we jump
to out_unmap which will return ERR_PTR(ret).  But ret can contain a
positive number just smaller than local_nr_pages, so be sure to set it
to -EFAULT always.

Problem found and diagnosed by Damien Le Moal <damien@sdl.hitachi.co.jp>

Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-17 10:52:12 -07:00
Kirill Korotaev 9cedc194a7 [PATCH] Return error in case flock_lock_file failure
If flock_lock_file() failed to allocate flock with locks_alloc_lock()
then "error = 0" is returned. Need to return some non-zero.

Signed-off-by: Pavel Emelianov <xemul@openvz.org>
Signed-off-by: Kirill Korotaev <dev@openvz.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-14 08:59:44 -07:00
Nathan Scott d7ede1aa5d [XFS] Minor XFS documentation updates.
Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-13 16:28:11 +10:00
David Woodhouse 4ed0156f77 [JFFS2] Fix more breakage caused by janitorial meddling.
jffs2_zlib_exit() and free_workspaces() shouldn't be marked __exit because
they get called in the error case from the init functions.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-09 15:06:42 +01:00
Nathan Scott b190f1138b [XFS] Fix broken const use inside local suffix_strtoul routine.
SGI-PV: 904196
SGI-Modid: xfs-linux-melb:xfs-kern:26201a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 17:13:15 +10:00
Mandy Kirkconnell 477829ef2e [XFS] Fix nused counter. It's currently getting set to -1 rather than
getting decremented by 1.  Since nused never reaches 0, the "if
(!free->hdr.nused)" check in xfs_dir2_leafn_remove() fails every time and
xfs_dir2_shrink_inode() doesn't get called when it should.  This causes
extra blocks to be left on an empty directory and the directory in unable
to be converted back to inline extent mode.

SGI-PV: 951958
SGI-Modid: xfs-linux-melb:xfs-kern:211382a

Signed-off-by: Mandy Kirkconnell <alkirkco@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 17:13:04 +10:00
Nathan Scott 421ad13458 [XFS] Fix mismerge of the fs_writable cleanup patch causing a freeze/thaw
test hang.

SGI-PV: 953563
SGI-Modid: xfs-linux-melb:xfs-kern:26182a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 17:12:46 +10:00
Nathan Scott 4d1a2ed3d8 [XFS] Fix up debug code so that bulkstat wont generate thousands of
fsstress warnings.

SGI-PV: 904196
SGI-Modid: xfs-linux-melb:xfs-kern:26111a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 17:12:28 +10:00
Nathan Scott a916e2bd15 [XFS] Remove unused parameter from di2xflags routine.
SGI-PV: 904192
SGI-Modid: xfs-linux-melb:xfs-kern:26110a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 17:12:17 +10:00
Nathan Scott 34327e1384 [XFS] Cleanup a missed porting conversion, and freezing.
SGI-PV: 953338
SGI-Modid: xfs-linux-melb:xfs-kern:26109a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 17:11:55 +10:00
Nathan Scott 8285fb58e7 [XFS] Resolve a namespace collision on remaining vtypes for FreeBSD
porters.

SGI-PV: 953338
SGI-Modid: xfs-linux-melb:xfs-kern:26108a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 17:07:12 +10:00
Nathan Scott 67fcaa73ad [XFS] Resolve a namespace collision on vnode/vnodeops for FreeBSD porters.
SGI-PV: 953338
SGI-Modid: xfs-linux-melb:xfs-kern:26107a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 17:00:52 +10:00
Nathan Scott b83bd13881 [XFS] Resolve a namespace collision on vfs/vfsops for FreeBSD porters.
SGI-PV: 9533338
SGI-Modid: xfs-linux-melb:xfs-kern:26106a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 16:48:30 +10:00
Nathan Scott 932f2c3231 [XFS] statvfs component of directory/project quota support, code
originally by Glen.

SGI-PV: 932952
SGI-Modid: xfs-linux-melb:xfs-kern:26105a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 15:29:58 +10:00
Nathan Scott b65745205f [XFS] Portability changes: remove prdev, stick to one diagnostic
interface.

SGI-PV: 953338
SGI-Modid: xfs-linux-melb:xfs-kern:26103a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 15:29:40 +10:00
Nathan Scott 9c48876a05 [XFS] Remove dead code from come bulkstat paths.
SGI-PV: 904196
SGI-Modid: xfs-linux-melb:xfs-kern:26102a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 15:29:22 +10:00
Nathan Scott ad723875ac [XFS] Fix a typo in a header file comment.
SGI-PV: 904196
SGI-Modid: xfs-linux-melb:xfs-kern:26101a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 15:29:12 +10:00
Nathan Scott 7d4fb40ad7 [XFS] Start writeout earlier (on last close) in the case where we have a
truncate down followed by delayed allocation (buffered writes) - worst
case scenario for the notorious NULL files problem.  This reduces the
window where we are exposed to that problem significantly.

SGI-PV: 917976
SGI-Modid: xfs-linux-melb:xfs-kern:26100a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 15:27:16 +10:00
Nathan Scott 59c1b082f5 [XFS] Make the pflags test/set wrappers more legible for us mere humans.
SGI-PV: 953338
SGI-Modid: xfs-linux-melb:xfs-kern:26099a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:59:13 +10:00
Nathan Scott e109007461 [XFS] Fix a buffer refcount leak in dir2 code on a forced shutdown.
SGI-PV: 904196
SGI-Modid: xfs-linux-melb:xfs-kern:26097a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:58:48 +10:00
Nathan Scott 7d04a335b6 [XFS] Shutdown the filesystem if all device paths have gone. Made
shutdown vop flags consistent with sync vop flags declarations too.

SGI-PV: 939911
SGI-Modid: xfs-linux-melb:xfs-kern:26096a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:58:38 +10:00
Nathan Scott b76963fac4 [XFS] getattr can return an error code, so propogate any from lower
layers.

SGI-PV: 904196
SGI-Modid: xfs-linux-melb:xfs-kern:26095a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:58:20 +10:00
Nathan Scott 3d80ede479 [XFS] Drop use of m_writeio_blocks when zeroing, its not meaningful
anymore here.

SGI-PV: 904196
SGI-Modid: xfs-linux-melb:xfs-kern:26094a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:57:30 +10:00
Ingo Molnar 72c93bcc63 [XFS] lock validator: lockdep: small xfs init_rwsem() cleanup
init_rwsem() has no return value.  This is not a problem if init_rwsem()
is a function, but it's a problem if it's a do { ...  } while (0) macro. 
(which lockdep introduces) 

SGI-PV: 904196
SGI-Modid: xfs-linux-melb:xfs-kern:26082a

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:57:01 +10:00
Tim Shimmin 87c199c2a7 [XFS] Over zealous with doing endian conversions. We endian converted the
logged version of di_next_unlinked which is actually always stored in the
correct ondisk format. This was pointed out to us by Shailendra Tripathi.
And is evident in the xfs qa test of 121.

SGI-PV: 953263
SGI-Modid: xfs-linux-melb:xfs-kern:26044a

Signed-off-by: Tim Shimmin <tes@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:56:16 +10:00
David Chinner 714250879e [XFS] Stop a BUG from occurring in generic_delete_inode by preventing
transaction completion from marking the inode dirty while it is being
cleaned up on it's way out of the system.

SGI-PV: 952967
SGI-Modid: xfs-linux-melb:xfs-kern:26040a

Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:55:52 +10:00
Tim Shimmin 6d192a9b82 [XFS] inode items and EFI/EFDs have different ondisk format for 32bit and
64bit kernels allow recovery to handle both versions and do the necessary
decoding

SGI-PV: 952214
SGI-Modid: xfs-linux-melb:xfs-kern:26011a

Signed-off-by: Tim Shimmin <tes@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:55:38 +10:00
Yingping Lu d210a28cd8 [XFS] In actual allocation of file system blocks and freeing extents, the
transaction within each such operation may involve multiple locking of AGF
buffer. While the freeing extent function has sorted the extents based on
AGF number before entering into transaction, however, when the file system
space is very limited, the allocation of space would try every AGF to get
space allocated, this could potentially cause out-of-order locking, thus
deadlock could happen. This fix mitigates the scarce space for allocation
by setting aside a few blocks without reservation, and avoid deadlock by
maintaining ascending order of AGF locking.

SGI-PV: 947395
SGI-Modid: xfs-linux-melb:xfs-kern:210801a

Signed-off-by: Yingping Lu <yingping@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:55:18 +10:00
Barry Naujok d3446eac3f [XFS] Add degframentation exclusion support
SGI-PV: 953061
SGI-Modid: xfs-linux-melb:xfs-kern:25986a

Signed-off-by: Barry Naujok <bnaujok@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:54:19 +10:00
Nathan Scott fbc1462bcb [XFS] Fix a noatime regression related to updating inode atime field on
mmap only.

SGI-PV: 952736
SGI-Modid: xfs-linux-melb:xfs-kern:25922a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:52:13 +10:00
Nathan Scott ba0b92d671 [XFS] Fix a comment typo, originally noticed by Ming Zhang.
SGI-PV: 907752
SGI-Modid: xfs-linux-melb:xfs-kern:25921a

Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:52:00 +10:00
Mandy Kirkconnell fe6c1e7240 [XFS] Fix size argument in kmem_free().
SGI-PV: 952291
SGI-Modid: xfs-linux-melb:xfs-kern:209807a

Signed-off-by: Mandy Kirkconnell <alkirkco@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:51:25 +10:00
Olaf Weber 3f368a0d58 [XFS] Originally the ATTR_DMI flag also had the functionality of the
ATTR_NOLOCK flag, but this was split off some time ago, as ATTR_DMI needed
to be used separately.	Two asserts were added to guard correctness of the
code during the transition.  These are no longer required.

SGI-PV: 952145
SGI-Modid: xfs-linux-melb:xfs-kern:209633a

Signed-off-by: Olaf Weber <olaf@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:51:11 +10:00
Christoph Hellwig 1d8daf06f6 [XFS] endianess annotations for xfs_dir_leaf_entry_t
SGI-PV: 943272
SGI-Modid: xfs-linux-melb:xfs-kern:25808a

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:50:37 +10:00
Christoph Hellwig 8034fff39b [XFS] endianess annotations for xfs_dir_leaf_hdr_t
SGI-PV: 943272
SGI-Modid: xfs-linux-melb:xfs-kern:25807a

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:50:24 +10:00
Christoph Hellwig ff9901c1e7 [XFS] endianess annotations for xfs_dir2_data_entry_t
SGI-PV: 943272
SGI-Modid: xfs-linux-melb:xfs-kern:25806a

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:48:37 +10:00
Olaf Weber 3e57ecf640 [XFS] Add parameters to xfs_bmapi() and xfs_bunmapi() to have them report
the range spanned by modifications to the in-core extent map.  Add
XFS_BUNMAPI() and XFS_SWAP_EXTENTS() macros that call xfs_bunmapi() and
xfs_swap_extents() via the ioops vector. Change all calls that may modify
the in-core extent map for the data fork to go through the ioops vector. 
This allows a cache of extent map data to be kept in sync.

SGI-PV: 947615
SGI-Modid: xfs-linux-melb:xfs-kern:209226a

Signed-off-by: Olaf Weber <olaf@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
2006-06-09 14:48:12 +10:00
Jens Axboe 71601e2b33 [PATCH] debugfs inode leak
Looking at the reiser4 crash, I found a leak in debugfs. In
debugfs_mknod(), we create the inode before checking if the dentry
already has one attached. We don't free it if that is the case.

These bugs happen quite often, I'm starting to think we should disallow
such coding in CodingStyle.

Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-08 15:14:24 -07:00
Trond Myklebust 6d09bb627d [PATCH] fs/namei.c: Call to file_permission() under a spinlock in do_lookup_path()
From: Trond Myklebust <Trond.Myklebust@netapp.com>

We're presently running lock_kernel() under fs_lock via nfs's ->permission
handler.  That's a ranking bug and sometimes a sleep-in-spinlock bug.  This
problem was introduced in the openat() patchset.

We should not need to hold the current->fs->lock for a codepath that doesn't
use current->fs.

[vsu@altlinux.ru: fix error path]
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Al Viro <viro@ftp.linux.org.uk>
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-05 12:29:16 -07:00
David Woodhouse 3bcc86f507 [JFFS2] Remove stray __exit from jffs2_compressors_exit()
It's used from the initfunc in case of failure too. We could actually do
with an '__initexit' for this kind of thing -- when built in to the
kernel, it could do with being dropped with the init text. We _could_
actually just use __init for it, but that would break if/when we start
dropping init text from modules. So let's just leave it as it was for now,
and mutter a little more about random 'janitorial' fixes from people who
aren't paying attention to what they're doing.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-03 00:25:50 +01:00
Andrew Morton 6855a3a6c3 [PATCH] ext3 resize: fix double unlock_super()
From: Andrew Morton <akpm@osdl.org>

Spotted by Jan Capek <jca@sysgo.com>

Cc: "Stephen C. Tweedie" <sct@redhat.com>
Cc: Andreas Dilger <adilger@clusterfs.com>
Cc: Jan Capek <jca@sysgo.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-31 16:27:10 -07:00
Steve French 55aa2e097d [[CIFS] Pass truncate open flag through on file open in case setattr fails
on set size to zero.

Signed-off-by: Sebastian Voitzsch <sebastoam/vpotzscj@web.de>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-05-30 18:09:31 +00:00
Steve French 08775834c4 [CIFS] Fix typos in previous fix
Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-05-30 18:08:26 +00:00
Steve French cec6815a12 [CIFS] endian fix for new POSIX byte range lock support
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-05-30 18:07:17 +00:00
Steve French a424f8bfcb [CIFS] fix memory leak in cifs session info struct on reconnect
Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-05-30 18:06:04 +00:00
Steve French c01f36a896 [CIFS] ACPI suspend oops
Wasn't able to reproduce a hard hang, but was able to get an oops if
suspended the machine during a copy to the cifs mount.  This led to some
things hanging, including a "sync".  Also got I/O errors when trying to
access the mount afterwards (even when didn't see the oops), and had
to unmount and remount in order to access the filesystem.

This patch fixed the oops.

Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-05-30 18:05:10 +00:00
Steve French a878fb2218 [CIFS] Do not limit the length of share names (was 100 for whole UNC name)
during mount. Especially important for some non-Western languages.

Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-05-30 18:04:19 +00:00
Steve French fc94cdb944 [CIFS] Fix new POSIX Locking for setting lock_type correctly on unlock
Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-05-30 18:03:32 +00:00
David Woodhouse 098a19811b [JFFS2] Preallocate node refs for cleanmarker in summary scan
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-30 09:00:14 +01:00
David Woodhouse 13ba42df4a [JFFS2] Fix calculation of potential summary marker offset on NOR flash.
Helps if we look _inside_ the buffer, rather than adding jeb->offset to
it. Doh.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-30 08:59:34 +01:00
Thomas Gleixner 9a1fcdfd4b [MTD] NAND Signal that a bitflip was corrected by ECC
Return -EUCLEAN on read when a bitflip was detected and corrected, so the
clients can react and eventually copy the affected block to a spare one.
Make all in kernel users aware of the change.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-29 15:06:51 +02:00
Thomas Gleixner 8593fbc68b [MTD] Rework the out of band handling completely
Hopefully the last iteration on this!

The handling of out of band data on NAND was accompanied by tons of fruitless
discussions and halfarsed patches to make it work for a particular
problem. Sufficiently annoyed by I all those "I know it better" mails and the
resonable amount of discarded "it solves my problem" patches, I finally decided
to go for the big rework. After removing the _ecc variants of mtd read/write
functions the solution to satisfy the various requirements was to refactor the
read/write _oob functions in mtd.

The major change is that read/write_oob now takes a pointer to an operation
descriptor structure "struct mtd_oob_ops".instead of having a function with at
least seven arguments.

read/write_oob which should probably renamed to a more descriptive name, can do
the following tasks:

- read/write out of band data
- read/write data content and out of band data
- read/write raw data content and out of band data (ecc disabled)

struct mtd_oob_ops has a mode field, which determines the oob handling mode.

Aside of the MTD_OOB_RAW mode, which is intended to be especially for
diagnostic purposes and some internal functions e.g. bad block table creation,
the other two modes are for mtd clients:

MTD_OOB_PLACE puts/gets the given oob data exactly to/from the place which is
described by the ooboffs and ooblen fields of the mtd_oob_ops strcuture. It's
up to the caller to make sure that the byte positions are not used by the ECC
placement algorithms.

MTD_OOB_AUTO puts/gets the given oob data automaticaly to/from the places in
the out of band area which are described by the oobfree tuples in the ecclayout
data structre which is associated to the devicee.

The decision whether data plus oob or oob only handling is done depends on the
setting of the datbuf member of the data structure. When datbuf == NULL then
the internal read/write_oob functions are selected, otherwise the read/write
data routines are invoked.

Tested on a few platforms with all variants. Please be aware of possible
regressions for your particular device / application scenario

Disclaimer: Any whining will be ignored from those who just contributed "hot
air blurb" and never sat down to tackle the underlying problem of the mess in
the NAND driver grown over time and the big chunk of work to fix up the
existing users. The problem was not the holiness of the existing MTD
interfaces. The problems was the lack of time to go for the big overhaul. It's
easy to add more mess to the existing one, but it takes alot of effort to go
for a real solution.

Improvements and bugfixes are welcome!

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-29 15:06:51 +02:00
Thomas Gleixner f4a43cfcec [MTD] Remove silly MTD_WRITE/READ macros
Most of those macros are unused and the used ones just obfuscate
the code. Remove them and fixup all users.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-29 15:06:50 +02:00
Thomas Gleixner 5bd34c091a [MTD] NAND Replace oobinfo by ecclayout
The nand_oobinfo structure is not fitting the newer error correction
demands anymore. Replace it by struct nand_ecclayout and fixup the users
all over the place. Keep the nand_oobinfo based ioctl for user space
compability reasons.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-29 15:06:50 +02:00
Thomas Gleixner ff268fb879 [MTD] NAND Consolidate oobinfo handling
The info structure for out of band data was copied into
the mtd structure. Make it a pointer and remove the ability
to set it from userspace. The position of ecc bytes is
defined by the hardware and should not be changed by software.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-29 15:06:49 +02:00
David Woodhouse a6a8bef722 [JFFS2] Preallocate raw_node_refs in a couple of missing places in scan
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-29 00:41:11 +01:00
David Woodhouse 2ebf09c249 [JFFS2] Fix oops when marking space dirty in scan, but no previous node exists.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-28 22:13:25 +01:00
David Woodhouse ddc58bd65e [JFFS2] Fix wbuf recovery of f->metadata->raw node.
A data node might not be in the fraglist; it could be f->metadata.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-27 13:15:16 +01:00
David Woodhouse 9bfeb691e7 [JFFS2] Switch to using an array of jffs2_raw_node_refs instead of a list.
This allows us to drop another pointer from the struct jffs2_raw_node_ref,
shrinking it to 8 bytes on 32-bit machines (if the TEST_TOTLEN) paranoia
check is turned off, which will be committed soon).

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-26 21:19:05 +01:00
Florin Malita 3ac8141366 [PATCH] affs: possible null pointer dereference in affs_rename()
If affs_bread() fails, the exit path calls mark_buffer_dirty_inode() with a
NULL argument.

Coverity CID: 312.

Signed-off-by: Florin Malita <fmalita@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-26 11:55:46 -07:00
David Woodhouse 89291a9d5b [JFFS2] Fix 64-bit size_t problems in XATTR code.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-25 13:30:24 +01:00
David Woodhouse 8b9e9fe8c6 [JFFS2] Fix and improve debugging output during scan.
Print wasted_size in scanned eraseblocks, print range correctly for
summary dirent and inode entries.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-25 01:53:09 +01:00
David Woodhouse 046b8b9808 [JFFS2] Add 'jeb' argument to jffs2_prealloc_raw_node_refs()
Preallocation of refs is shortly going to be a per-eraseblock thing,
rather than per-filesystem. Add the required argument to the function.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-25 01:50:35 +01:00
David Woodhouse f61579c337 [JFFS2] Correctly handle wasted space before summary node.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-25 01:42:40 +01:00
David Woodhouse c38c1b613d [JFFS2] jffs2_free_all_node_refs() doesn't free them all. Rename it.
... to jffs2_free_jeb_node_refs() since that's what it does.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-25 01:38:27 +01:00
David Woodhouse f560928baa [JFFS2] Allocate node_ref for wasted space when skipping to page boundary
One more place where we were changing the accounting info without
actually allocating a ref for the lost space...

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-25 01:37:28 +01:00
David Woodhouse c7c16c8e76 [JFFS2] Revert Artem's Bunkage in debug messages.
Random unthinking 'cleanup' caused debug messages like this:
   Obsoleting node at 0x0006daf4 of len 0x3a4: <7>Dirtying

If messages are continuation of an existing line, they don't need
to be prefixed with KERN_DEBUG.

THINK. Or you will be replaced by a small shell script.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-24 14:24:02 +01:00
Dave Kleikamp b964638ffd JFS: Fix multiple errors in metapage_releasepage
It looks like metapage_releasepage was making in invalid assumption that
the releasepage method would not be called on a dirty page.  Instead of
issuing a warning and releasing the metapage, it should return 0, indicating
that the private data for the page cannot be released.

I also realized that metapage_releasepage had the return code all wrong.  If
it is successful in releasing the private data, it should return 1, otherwise
it needs to return 0.

Lastly, there is no need to call wait_on_page_writeback, since
try_to_release_page will not call us with a page in writback state.

Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
2006-05-24 07:43:38 -05:00
David Woodhouse 0305c8659f Merge branch 'master' of git://git.infradead.org/~gleixner/mtd-nand-2.6.git 2006-05-24 10:01:43 +01:00
David Woodhouse 99988f7bbd [JFFS2] Introduce ref_next() macro for finding next physical node
Another part of the preparation for switching to an array...

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-24 09:04:17 +01:00
David Woodhouse 2f785402f3 [JFFS2] Reduce visibility of raw_node_ref to upper layers of JFFS2 code.
As the first step towards eliminating the ref->next_phys member and saving
memory by using an _array_ of struct jffs2_raw_node_ref per eraseblock,
stop the write functions from allocating their own refs; have them just
_reserve_ the appropriate number instead. Then jffs2_link_node_ref() can
just fill them in.

Use a linked list of pre-allocated refs in the superblock, for now. Once
we switch to an array, it'll just be a case of extending that array.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-24 02:04:45 +01:00
NeilBrown a2eb0c101d [PATCH] md: Make sure bi_max_vecs is set properly in bio_split
Else a subsequent bio_clone might make a mess.

Signed-off-by: Neil Brown <neilb@suse.de>
Cc: "Don Dupuis" <dondster@gmail.com>
Acked-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-23 10:35:31 -07:00
NeilBrown f2d395865f [PATCH] knfsd: Fix two problems that can cause rmmod nfsd to die
Both cause the 'entries' count in the export cache to be non-zero at module
removal time, so unregistering that cache fails and results in an oops.

1/ exp_pseudoroot (used for NFSv4 only) leaks a reference to an export
   entry.
2/ sunrpc_cache_update doesn't increment the entries count when it adds
   an entry.

Thanks to "david m.  richter" <richterd@citi.umich.edu> for triggering the
problem and finding one of the bugs.

Cc: "david m. richter" <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-23 10:35:31 -07:00
Thomas Gleixner 9223a456da [MTD] Remove read/write _ecc variants
MTD clients are agnostic of FLASH which needs ECC suppport.
Remove the functions and fixup the callers.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-23 17:21:03 +02:00
Thomas Gleixner 4cbb9b80e1 Merge branch 'master' of /home/tglx/work/kernel/git/mtd-2.6/
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-23 12:37:31 +02:00
Thomas Gleixner dcb0932884 [JFFS2] Simplify writebuffer handling
The writev based write buffer implementation was far to complex as
in most use cases the write buffer had to be handled anyway.
Simplify the write buffer handling and use mtd->write instead.

From extensive testing no performance impact has been noted.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-23 11:49:14 +02:00
David Woodhouse 9fe4854cd1 [JFFS2] Remove flash offset argument from various functions.
We don't need the upper layers to deal with the physical offset. It's
_always_ c->nextblock->offset + c->sector_size - c->nextblock->free_size
so we might as well just let the actual write functions deal with that.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-23 00:38:06 +01:00
Joern Engel 5fa433942b [MTD] Introduce MTD_BIT_WRITEABLE
o Add a flag MTD_BIT_WRITEABLE for devices that allow single bits to be
  cleared.
o Replace MTD_PROGRAM_REGIONS with a cleared MTD_BIT_WRITEABLE flag for
  STMicro and Intel Sibley flashes with internal ECC.  Those flashes
  disallow clearing of single bits, unlike regular NOR flashes, so the
  new flag models their behaviour better.
o Remove MTD_ECC.  After the STMicro/Sibley merge, this flag is only set
  and never checked.

Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
2006-05-22 23:18:29 +02:00
Joern Engel c8b229de2b [MTD] Merge STMicro NOR_ECC code with Intel Sibley code
In 2002, STMicro started producing NOR flashes with internal ECC protection
for small blocks (8 or 16 bytes).  Support for those flashes was added by me.
In 2005, Intel Sibley flashes copied this strategy and Nico added support for
those.  Merge the code for both.

Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
2006-05-22 23:18:12 +02:00
Joern Engel 28318776a8 [MTD] Introduce writesize
At least two flashes exists that have the concept of a minimum write unit,
similar to NAND pages, but no other NAND characteristics.  Therefore, rename
the minimum write unit to "writesize" for all flashes, including NAND.

Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
2006-05-22 23:18:05 +02:00
David Woodhouse 987d47b71a [JFFS2] Put list of nodes in common part of ic/x_ref/x_datum structure
We'll be using a proper list of nodes in the jffs2_xattr_datum and
jffs2_xattr_ref structures, because the existing code to overwrite
them is just broken. Put it in the common part at the front of the
structure which is shared with the jffs2_inode_cache, so that the
jffs2_link_node_ref() function can do the right thing.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-22 16:32:05 +01:00
David Woodhouse 0eac940b8a [JFFS2] Add some preemptive BUG checks for XATTR code
In a couple of places, we assume that what's at the end of the
->next_in_ino list is a struct jffs2_inode_cache. Let's check
for that, since we expect it to change soon.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-22 16:29:23 +01:00
David Woodhouse fcb7578719 [JFFS2] Extend jffs2_link_node_ref() to link into per-inode list too.
Let's avoid the potential for forgetting to set ref->next_in_ino, by doing
it within jffs2_link_node_ref() instead.

This highlights the ugliness of what we're currently doing with
xattr_datum and xattr_ref structures -- we should find a nicer way of
dealing with that.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-22 15:23:10 +01:00
David Woodhouse a1b563d652 [JFFS2] Initialise ref->next_in_ino when marking dirty space in wbuf flush
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-22 13:55:46 +01:00
David Woodhouse 3b79673cfa [JFFS2] Fix accounting error in jffs2_link_node_ref()
When filing REF_OBSOLETE nodes, we'd add their size to the global
'dirty_size' count, but then to the eraseblock's 'used_size' count.
That's not clever.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-22 12:15:47 +01:00
David Woodhouse 06c6764b58 [JFFS2] Fix dummy jffs2_sum_scan_sumnode() macro for !SUMMARY case.
I added an argument to the real function...

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-22 11:27:14 +01:00
Amy Griffis d66fd908ac [PATCH] fix NULL dereference in inotify_ignore
Don't reassign to watch.  If idr_find() returns NULL, then
put_inotify_watch() will choke.

Signed-off-by: Amy Griffis <amy.griffis@hp.com>
Cc: John McCutchan <john@johnmccutchan.com>
Cc: Robert Love <rlove@rlove.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-21 12:59:18 -07:00
Amy Griffis 66055a4e73 [PATCH] fix race in inotify_release
While doing some inotify stress testing, I hit the following race.  In
inotify_release(), it's possible for a watch to be removed from the lists
in between dropping dev->mutex and taking inode->inotify_mutex.  The
reference we hold prevents the watch from being freed, but not from being
removed.

Checking the dev's idr mapping will prevent a double list_del of the
same watch.

Signed-off-by: Amy Griffis <amy.griffis@hp.com>
Acked-by: John McCutchan <john@johnmccutchan.com>
Cc: Robert Love <rml@novell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-21 12:59:18 -07:00
Andrew Morton df88912a21 [PATCH] binfmt_flat: don't check for EMFILE
Bernd Schmidt points out that binfmt_flat is now leaving the exec file open
while the application runs.  This offsets all the application's fd numbers.
We should have closed the file within exec(), not at exit()-time.

But there doesn't seem to be a lot of point in doing all this just to avoid
going over RLIMIT_NOFILE by one fd for a few microseconds.  So take the EMFILE
checking out again.  This will cause binfmt_flat to again fail LTP's
exec-should-return-EMFILE-when-fdtable-is-full test.  That test appears to be
wrong anyway - Open Group specs say nothing about exec() returning EMFILE.

Cc: Bernd Schmidt <bernd.schmidt@analog.com>
Cc: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-21 12:59:17 -07:00
Florin Malita 9ccfc29c67 [PATCH] nfsd: sign conversion obscuring errors in nfsd_set_posix_acl()
Assigning the result of posix_acl_to_xattr() to an unsigned data type
(size/size_t) obscures possible errors.

Coverity CID: 1206.

Signed-off-by: Florin Malita <fmalita@gmail.com>
Acked-by: NeilBrown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-21 12:59:17 -07:00
Peter Staubach 8c7b389e53 [PATCH] NFS server subtree_check returns dubious value
Address a problem found when a Linux NFS server uses the "subtree_check"
export option.

The "subtree_check" NFS export option was designed to prohibit a client
from using a file handle for which it should not have permission.  The
algorithm used is to ensure that the entire path to the file being
referenced is accessible to the user attempting to use the file handle.  If
some part of the path is not accessible, then the operation is aborted and
the appropriate version of ESTALE is returned to the NFS client.

The error, ESTALE, is unfortunate in that it causes NFS clients to make
certain assumptions about the continued existence of the file.  They assume
that the file no longer exists and refuse to attempt to access it again.
In this case, the file really does exist, but access was denied by the
server for a particular user.

A better error to return would be an EACCES sort of error.  This would
inform the client that the particular operation that it was attempting was
not allowed, without the nasty side effects of the ESTALE error.

Signed-off-by: Peter Staubach <staubach@redhat.com>
Acked-By: NeilBrown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-21 12:59:16 -07:00
Lin Feng Shen d64b1c878f [PATCH] NFS: fix error handling on access_ok in compat_sys_nfsservctl
Functions compat_nfs_svc_trans, compat_nfs_clnt_trans,
compat_nfs_exp_trans, compat_nfs_getfd_trans and compat_nfs_getfs_trans,
which are called by compat_sys_nfsservctl(fs/compat.c), don't handle the
return value of access_ok properly.  access_ok return 1 when the addr is
valid, and 0 when it's not, but these functions have the reversed
understanding.  When the address is valid, they always return -EFAULT to
compat_sys_nfsservctl.

An example is to run /usr/sbin/rpc.nfsd(32bit program on Power5).  It
doesn't function as expected.  strace showes that nfsservctl returns
-EFAULT.

The patch fixes this by correcting the error handling on the return value
of access_ok in the five functions.

Signed-off-by: Lin Feng Shen <shenlinf@cn.ibm.com>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Acked-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-21 12:59:16 -07:00
David Woodhouse ca89a517fa [JFFS2] Finally eliminate __totlen field from struct jffs2_raw_node_ref
Well, almost. We'll actually keep a 'TEST_TOTLEN' macro set for now, and keep
doing some paranoia checks to make sure it's all working correctly. But if
TEST_TOTLEN is unset, the size of struct jffs2_raw_node_ref drops from 16
bytes to 12 on 32-bit machines. That's a saving of about half a megabyte of
memory on the OLPC prototype board, with 125K or so nodes in its 512MiB of
flash.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-21 13:29:11 +01:00