summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* fs/ufs: get rid of write_superArtem Bityutskiy2012-07-225-16/+42
| | | | | | | | | | | | | | | | | | | | | | | This patch makes UFS stop using the VFS '->write_super()' method along with the 's_dirt' superblock flag, because they are on their way out. The way we implement this is that we schedule a delay job instead relying on 's_dirt' and '->write_super()'. The whole "superblock write-out" VFS infrastructure is served by the 'sync_supers()' kernel thread, which wakes up every 5 (by default) seconds and writes out all dirty superblocks using the '->write_super()' call-back. But the problem with this thread is that it wastes power by waking up the system every 5 seconds, even if there are no diry superblocks, or there are no client file-systems which would need this (e.g., btrfs does not use '->write_super()'). So we want to kill it completely and thus, we need to make file-systems to stop using the '->write_super()' VFS service, and then remove it together with the kernel thread. Tested using fsstress from the LTP project. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* fs/ufs: re-arrange the code a bitArtem Bityutskiy2012-07-221-59/+58Star
| | | | | | | | | This patch does not do any functional changes. It only moves 3 functions in fs/ufs/super.c a little bit up in order to prepare for further changes where I'll need this new arrangement to avoid forward declarations. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* fs/ufs: remove extra superblock write on unmountArtem Bityutskiy2012-07-221-3/+0Star
| | | | | | | | | | UFS calls 'ufs_write_super()' from 'ufs_put_super()' in order to write the superblocks to the media. However, it is not needed because VFS calls '->sync_fs()' before calling '->put_super()' - so by the time we are in 'ufs_write_super()', the superblocks are already synchronized. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* fs/sysv: stop using write_super and s_dirtArtem Bityutskiy2012-07-222-11/+0Star
| | | | | | | | | | | | | | | | | | | It does not look like sysv FS needs 'write_super()' at all, because all it does is a timestamp update. I cannot test this patch, because this file-system is so old and probably has not been used by anyone for years, so there are no tools to create it in Linux. But from the code I see that marking the superblock as dirty is basically marking the superblock buffers as drity and then setting the s_dirt flag. And when 'write_super()' is executed to handle the s_dirt flag, we just update the timestamp and again mark the superblock buffer as dirty. Seems pointless. It looks like we can update the timestamp more opprtunistically - on unmount or remount of sync, and nothing should change. Thus, this patch removes 'sysv_write_super()' and 's_dirt'. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* fs/sysv: remove another useless write_super callArtem Bityutskiy2012-07-221-4/+1Star
| | | | | | | | | | We do not need to call 'sysv_write_super()' from 'sysv_remount()', because VFS has called 'sysv_sync_fs()' before calling '->remount()'. So remove it. Remove also '(un)lock_super()' which obvioulsy is becoming useless in this function. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* fs/sysv: remove useless write_super callArtem Bityutskiy2012-07-221-3/+0Star
| | | | | | | | | We do not need to call 'sysv_write_super()' from 'sysv_put_super()', because VFS has called 'sysv_sync_fs()' before calling '->put_super()'. So remove it. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* hfs: get rid of hfs_sync_superArtem Bityutskiy2012-07-224-39/+48
| | | | | | | | | | | | | | | | | | | | This patch makes hfs stop using the VFS '->write_super()' method along with the 's_dirt' superblock flag, because they are on their way out. The whole "superblock write-out" VFS infrastructure is served by the 'sync_supers()' kernel thread, which wakes up every 5 (by default) seconds and writes out all dirty superblocks using the '->write_super()' call-back. But the problem with this thread is that it wastes power by waking up the system every 5 seconds, even if there are no diry superblocks, or there are no client file-systems which would need this (e.g., btrfs does not use '->write_super()'). So we want to kill it completely and thus, we need to make file-systems to stop using the '->write_super()' VFS service, and then remove it together with the kernel thread. Tested using fsstress from the LTP project. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* hfs: introduce VFS superblock object back-referenceArtem Bityutskiy2012-07-222-5/+2Star
| | | | | | | | | | | | Add an 'sb' VFS superblock back-reference to the 'struct hfs_sb_info' data structure - we will need to find the VFS superblock from a 'struct hfs_sb_info' object in the next patch, so this change is jut a preparation. Remove few useless newlines while on it. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* hfs: simplify a bit checking for R/OArtem Bityutskiy2012-07-223-4/+5
| | | | | | | | | | | | | We have the following pattern in 2 places in HFS if (!RDONLY) hfs_mdb_commit(); This patch pushes the RDONLY check down to 'hfs_mdb_commit()'. This will make the following patches a bit simpler. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* hfs: remove extra mdb write on unmountArtem Bityutskiy2012-07-221-2/+0Star
| | | | | | | | | | HFS calls 'hfs_write_super()' from 'hfs_put_super()' in order to write the MDB to the media. However, it is not needed because VFS calls '->sync_fs()' before calling '->put_super()' - so by the time we are in 'hfs_write_super()', the MDB is already synchronized. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* hfs: get rid of lock_superArtem Bityutskiy2012-07-221-2/+10
| | | | | | | | Stop using lock_super for serializing the MDB changes - use the buffer-head own lock instead. Tested with fsstress. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* hfs: push lock_super downArtem Bityutskiy2012-07-223-6/+2Star
| | | | | | | | | HFS uses 'lock_super()'/'unlock_super()' around 'hfs_mdb_commit()' in order to serialize MDB (Master Directory Block) changes. Push it down to 'hfs_mdb_commit()' in order to simplify the code a bit. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* hfsplus: get rid of write_superArtem Bityutskiy2012-07-225-16/+43
| | | | | | | | | | | | | | | | | | | | This patch makes hfsplus stop using the VFS '->write_super()' method along with the 's_dirt' superblock flag, because they are on their way out. The whole "superblock write-out" VFS infrastructure is served by the 'sync_supers()' kernel thread, which wakes up every 5 (by default) seconds and writes out all dirty superblocks using the '->write_super()' call-back. But the problem with this thread is that it wastes power by waking up the system every 5 seconds, even if there are no diry superblocks, or there are no client file-systems which would need this (e.g., btrfs does not use '->write_super()'). So we want to kill it completely and thus, we need to make file-systems to stop using the '->write_super()' VFS service, and then remove it together with the kernel thread. Tested using fsstress from the LTP project. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* hfsplus: remove useless checkArtem Bityutskiy2012-07-221-3/+0Star
| | | | | | | This check is useless because we always have 'sb->s_fs_info' to be non-NULL. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* hfsplus: amend debugging printArtem Bityutskiy2012-07-221-1/+1
| | | | | | | | Print correct function name in the debugging print of the 'hfsplus_sync_fs()' function. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* hfsplus: make hfsplus_sync_fs staticArtem Bityutskiy2012-07-222-2/+1Star
| | | | | | | ... because it is used only in fs/hfsplus/super.c. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* hold task_lock around checks in keyctlAl Viro2012-07-221-0/+2
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* get rid of ->scm_work_listAl Viro2012-07-223-21/+3Star
| | | | | | recursion in __scm_destroy() will be cut by delaying final fput() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* aio: now fput() is OK from interrupt context; get rid of manual delayed __fput()Al Viro2012-07-221-70/+3Star
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* switch fput to task_work_addAl Viro2012-07-223-3/+75
| | | | | | | | | | | | | | | | | ... and schedule_work() for interrupt/kernel_thread callers (and yes, now it *is* OK to call from interrupt). We are guaranteed that __fput() will be done before we return to userland (or exit). Note that for fput() from a kernel thread we get an async behaviour; it's almost always OK, but sometimes you might need to have __fput() completed before you do anything else. There are two mechanisms for that - a general barrier (flush_delayed_fput()) and explicit __fput_sync(). Both should be used with care (as was the case for fput() from kernel threads all along). See comments in fs/file_table.c for details. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* deal with task_work callbacks adding more workAl Viro2012-07-221-12/+14
| | | | | | | | | It doesn't matter on normal return to userland path (we'll recheck the NOTIFY_RESUME flag anyway), but in case of exit_task_work() we'll need that as soon as we get callbacks capable of triggering more task_work_add(). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* move exit_task_work() past exit_files() et.al.Al Viro2012-07-222-23/+13Star
| | | | | | ... and get rid of PF_EXITING check in task_work_add(). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* merge task_work and rcu_head, get rid of separate allocation for keyring caseAl Viro2012-07-228-52/+31Star
| | | | | | | | task_work and rcu_head are identical now; merge them (calling the result struct callback_head, rcu_head #define'd to it), kill separate allocation in security/keys since we can just use cred->rcu now. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* trim task_work: get rid of hlistAl Viro2012-07-225-36/+38
| | | | | | | | | | layout based on Oleg's suggestion; single-linked list, task->task_works points to the last element, forward pointer from said last element points to head. I'd still prefer much more regular scheme with two pointers in task_work, but... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* trimming task_work: kill ->dataAl Viro2012-07-225-12/+17
| | | | | | | | get rid of the only user of ->data; this is _not_ the final variant - in the end we'll have task_work and rcu_head identical and just use cred->rcu, at which point the separate allocation will be gone completely. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* signal: make sure we don't get stopped with pending task_workAl Viro2012-07-221-0/+15
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* use __lookup_hash() in kern_path_parent()Al Viro2012-07-221-1/+1
| | | | | | No need to bother with lookup_one_len() here - it's an overkill Signed-off-by Al Viro <viro@zeniv.linux.org.uk>
* VFS: Split inode_permission()David Howells2012-07-142-17/+54
| | | | | | | | | | | | | Split inode_permission() into inode- and superblock-dependent parts. This is aimed at unionmounts where the superblock from the upper layer has to be checked rather than the superblock from the lower layer as the upper layer may be writable, thus allowing an unwritable file from the lower layer to be copied up and modified. Original-author: Valerie Aurora <vaurora@redhat.com> Signed-off-by: David Howells <dhowells@redhat.com> (Further development) Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* VFS: Pass mount flags to sget()David Howells2012-07-1420-50/+40Star
| | | | | | | | | Pass mount flags to sget() so that it can use them in initialising a new superblock before the set function is called. They could also be passed to the compare function. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* VFS: Comment mount following codeDavid Howells2012-07-142-2/+24
| | | | | | | | | Add comments describing what the directions "up" and "down" mean and ref count handling to the VFS mount following family of functions. Signed-off-by: Valerie Aurora <vaurora@redhat.com> (Original author) Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* VFS: Make clone_mnt()/copy_tree()/collect_mounts() return errorsDavid Howells2012-07-143-62/+73
| | | | | | | | | | | | | | | | | | copy_tree() can theoretically fail in a case other than ENOMEM, but always returns NULL which is interpreted by callers as -ENOMEM. Change it to return an explicit error. Also change clone_mnt() for consistency and because union mounts will add new error cases. Thanks to Andreas Gruenbacher <agruen@suse.de> for a bug fix. [AV: folded braino fix by Dan Carpenter] Original-author: Valerie Aurora <vaurora@redhat.com> Signed-off-by: David Howells <dhowells@redhat.com> Cc: Valerie Aurora <valerie.aurora@gmail.com> Cc: Andreas Gruenbacher <agruen@suse.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* VFS: Make chown() and lchown() call fchownat()David Howells2012-07-141-34/+7Star
| | | | | | | | Make the chown() and lchown() syscalls jump to the fchownat() syscall with the appropriate extra arguments. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* do_dentry_open(): close the race with mark_files_ro() in failure exitAl Viro2012-07-141-1/+1
| | | | | | | we want to take it out of mark_files_ro() reach *before* we start checking if we ought to drop write access. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* mark_files_ro(): don't bother with mntget/mntputAl Viro2012-07-141-8/+1Star
| | | | | | mnt_drop_write_file() is safe under any lock Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* notify_change(): check that i_mutex is heldAndrew Morton2012-07-141-1/+2
| | | | | | | Cc: Djalal Harouni <tixxdz@opendz.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* fs: add nd_jump_linkChristoph Hellwig2012-07-143-12/+20
| | | | | | | | | | Add a helper that abstracts out the jump to an already parsed struct path from ->follow_link operation from procfs. Not only does this clean up the code by moving the two sides of this game into a single helper, but it also prepares for making struct nameidata private to namei.c Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* fs: move path_put on failure out of ->follow_linkChristoph Hellwig2012-07-142-6/+9
| | | | | | | | | | | | Currently the non-nd_set_link based versions of ->follow_link are expected to do a path_put(&nd->path) on failure. This calling convention is unexpected, undocumented and doesn't match what the nd_set_link-based instances do. Move the path_put out of the only non-nd_set_link based ->follow_link instance into the caller. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* debugfs: get rid of useless arguments to debugfs_{mkdir,symlink}Al Viro2012-07-141-11/+9Star
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* debugfs: fold debugfs_create_by_name() into the only callerAl Viro2012-07-141-33/+20Star
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* debugfs: make sure that debugfs_create_file() gets used only for regularsAl Viro2012-07-141-22/+34
| | | | | | | It, debugfs_create_dir() and debugfs_create_link() use the common helper now. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* __d_unalias() should refuse to move mountpointsAl Viro2012-07-141-4/+5
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* sysfs: just use d_materialise_unique()Al Viro2012-07-141-8/+1Star
| | | | | | same as for nfs et.al. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* sysfs: switch to ->s_d_op and ->d_release()Al Viro2012-07-143-10/+8Star
| | | | | | | | | a) ->d_iput() is wrong here - what we do to inode is completely usual, it's dentry->d_fsdata that we want to drop. Just use ->d_release(). b) switch to ->s_d_op - no need to play with d_set_d_op() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* get rid of kern_path_parent()Al Viro2012-07-144-82/+65Star
| | | | | | | | | all callers want the same thing, actually - a kinda-sorta analog of kern_path_create(). I.e. they want parent vfsmount/dentry (with ->i_mutex held, to make sure the child dentry is still their child) + the child dentry. Signed-off-by Al Viro <viro@zeniv.linux.org.uk>
* VFS: Fix the banner comment on lookup_open()David Howells2012-07-141-3/+26
| | | | | | | | | | | | Since commit 197e37d9, the banner comment on lookup_open() no longer matches what the function returns. It used to return a struct file pointer or NULL and now it returns an integer and is passed the struct file pointer it is to use amongst its arguments. Update the comment to reflect this. Also add a banner comment to atomic_open(). Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* don't pass nameidata * to vfs_create()Al Viro2012-07-146-10/+11
| | | | | | all we want is a boolean flag, same as the method gets now Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* don't pass nameidata to ->create()Al Viro2012-07-1451-64/+62Star
| | | | | | | | boolean "does it have to be exclusive?" flag is passed instead; Local filesystem should just ignore it - the object is guaranteed not to be there yet. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* fs/namei.c: don't pass nameidata to __lookup_hash() and lookup_real()Al Viro2012-07-141-10/+10
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* stop passing nameidata to ->lookup()Al Viro2012-07-1479-114/+115
| | | | | | | | | Just the flags; only NFS cares even about that, but there are legitimate uses for such argument. And getting rid of that completely would require splitting ->lookup() into a couple of methods (at least), so let's leave that alone for now... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* fs/namei.c: don't pass namedata to lookup_dcache()Al Viro2012-07-141-4/+4
| | | | | | just the flags... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>