summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* cifs: support RENAME_NOREPLACEMiklos Szeredi2014-08-073-5/+15
| | | | | | | | | | | | This flag gives CIFS the ability to support its native rename semantics. Implementation is simple: just bail out before trying to hack around the noreplace semantics. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Cc: Steve French <smfrench@gmail.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* hostfs: support rename flagsMiklos Szeredi2014-08-073-10/+49
| | | | | | | | | | | | | Support RENAME_NOREPLACE and RENAME_EXCHANGE flags on hostfs if the underlying filesystem supports it. Since renameat2(2) is not yet in any libc, use syscall(2) to invoke the renameat2 syscall. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Cc: Richard Weinberger <richard@nod.at> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* shmem: support RENAME_EXCHANGEMiklos Szeredi2014-08-071-1/+26
| | | | | | | | | | | This is really simple in tmpfs since the VFS already takes care of shuffling the dentries. Just adjust nlink on parent directories and touch c & mtimes. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Acked-by: Hugh Dickins <hughd@google.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* shmem: support RENAME_NOREPLACEMiklos Szeredi2014-08-071-2/+5
| | | | | | | | | Implement ->rename2 instead of ->rename. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Acked-by: Hugh Dickins <hughd@google.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* btrfs: add RENAME_NOREPLACEMiklos Szeredi2014-08-071-1/+11
| | | | | | | | | | | RENAME_NOREPLACE is trivial to implement for most filesystems: switch over to ->rename2() and check for the supported flags. The rest is done by the VFS. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Cc: Chris Mason <clm@fb.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* bad_inode: add ->rename2()Miklos Szeredi2014-08-071-3/+4
| | | | | | | | so we return -EIO instead of -EINVAL. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* fs: call rename2 if existsMiklos Szeredi2014-08-073-10/+3
| | | | | | | | | | | | | | Christoph Hellwig suggests: 1) make vfs_rename call ->rename2 if it exists instead of ->rename 2) switch all filesystems that you're adding NOREPLACE support for to use ->rename2 3) see how many ->rename instances we'll have left after a few iterations of 2. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* kernel/acct.c: fix coding style warnings and errorsIonut Alexa2014-08-071-12/+16
| | | | | | Signed-off-by: Ionut Alexa <ionut.m.alexa@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* death to mnt_pinnedAl Viro2014-08-074-34/+30
| | | | | | | | | | | | | | | | | | | | | Rather than playing silly buggers with vfsmount refcounts, just have acct_on() ask fs/namespace.c for internal clone of file->f_path.mnt and replace it with said clone. Then attach the pin to original vfsmount. Voila - the clone will be alive until the file gets closed, making sure that underlying superblock remains active, etc., and we can drop the original vfsmount, so that it's not kept busy. If the file lives until the final mntput of the original vfsmount, we'll notice that there's an fs_pin (one in bsd_acct_struct that holds that file) and mnt_pin_kill() will take it out. Since ->kill() is synchronous, we won't proceed past that point until these files are closed (and private clones of our vfsmount are gone), so we get the same ordering warranties we used to get. mnt_pin()/mnt_unpin()/->mnt_pinned is gone now, and good riddance - it never became usable outside of kernel/acct.c (and racy wrt umount even there). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* make fs/{namespace,super}.c forget about acct.hAl Viro2014-08-075-10/+13
| | | | | | | These externs belong in fs/internal.h. Rename (they are not acct-specific anymore) and move them over there. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* take fs_pin stuff to fs/*Al Viro2014-08-075-100/+129
| | | | | | | | | | | | | | | Add a new field to fs_pin - kill(pin). That's what umount and r/o remount will be calling for all pins attached to vfsmount and superblock resp. Called after bumping the refcount, so it won't go away under us. Dropping the refcount is responsibility of the instance. All generic stuff moved to fs/fs_pin.c; the next step will rip all the knowledge of kernel/acct.c from fs/super.c and fs/namespace.c. After that - death to mnt_pin(); it was intended to be usable as generic mechanism for code that wants to attach objects to vfsmount, so that they would not make the sucker busy and would get killed on umount. Never got it right; it remained acct.c-specific all along. Now it's very close to being killable. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* start carving bsd_acct_struct upAl Viro2014-08-071-19/+23
| | | | | | | | pull generic parts into struct fs_pin. Eventually we want those to replace mnt_pin()/mnt_unpin() mess; that stuff will move to fs/*. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* acct: move mnt_pin() upwards.Al Viro2014-08-071-2/+1
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* make acct_kill() wait for file closing.Al Viro2014-08-071-3/+17
| | | | | | | Do actual closing of file via schedule_work(). And use __fput_sync() there. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* drop ->s_umount around acct_auto_close()Al Viro2014-08-071-4/+14
| | | | | | | | | | just repeat the frozen check after regaining it, and check that sb is still alive. If several threads hit acct_auto_close() at the same time, acct_auto_close() will survive that just fine. And we really don't want to play with writes and closing the file with ->s_umount held exclusive - it's a deadlock country. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* acct: get rid of acct_lock for acct->countAl Viro2014-08-071-33/+52
| | | | | | | | | * make acct->count atomic and acct freeing - rcu-delayed. * instead of grabbing acct_lock around the places where we take a reference, do that under rcu_read_lock() with atomic_long_inc_not_zero(). * have the new acct locked before making ns->bacct point to it Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* acct: get rid of acct_listAl Viro2014-08-076-85/+62
| | | | | | | | Put these suckers on per-vfsmount and per-superblock lists instead. Note: right now it's still acct_lock for everything, but that's going to change. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* acct: simplify check_free_space()Al Viro2014-08-071-39/+11
| | | | | | | | | a) file can't be NULL b) file can't be changed under us c) all writes are serialized by acct->lock; no need to mess with spinlock there. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* acct: new lifetime rulesAl Viro2014-08-071-106/+114
| | | | | | | | | | | | | | | | | | | | Do not reuse bsd_acct_struct after closing the damn thing. Structure lifetime is controlled by refcount now. We also have a mutex in there, held over closing and writing (the file is O_APPEND, so we are not losing any concurrency). As the result, we do not need to bother with get_file()/fput() on log write anymore. Moreover, do_acct_process() only needs acct itself; file and pidns are picked from it. Killed instances are distinguished by having NULL ->ns. Refcount is protected by acct_lock; anybody taking the mutex needs to grab a reference first. The things will get a lot simpler in the next commits - this is just the minimal chunk switching to the new lifetime rules. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* acct: serialize acct_on()Al Viro2014-08-071-0/+4
| | | | | | brute-force - on a global mutex that isn't nested into anything. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* acct() should honour the limits from the very beginningAl Viro2014-08-071-2/+2
| | | | | | We need to check free space on the first write to freshly opened log. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* split the slow path in acct_process() offAl Viro2014-08-071-22/+28
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* separate namespace-independent parts of filling acct_tAl Viro2014-08-071-47/+51
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* acct: switch to __kernel_write()Al Viro2014-08-073-20/+13
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* acct: encode_comp_t(0) is 0, fortunately...Al Viro2014-08-071-3/+0
| | | | | | | | | | | | | | | | | | | | | | There was an amusing bogosity in ac_rw calculation - it tried to do encode_comp_t(encode_comp_t(0) / 1024). Seeing that comp_t is a 3-bit exponent + 13-bit mantissa... it's a good thing that 0 is represented by all-bits-clear. The history of that one is interesting - it was introduced in 2.1.68pre1, when acct.c had been reworked and moved to separate file. Two months later (2.1.86) somebody has noticed that the sucker won't compile - there was no task_struct::io_usage. At which point the ac_io calculation had changed from encode_comp_t(current->io_usage) to encode_comp_t(0) and the bug in the next line (absolutely real back then, had it ever managed to compile) become a harmless bogosity. Looks like nobody has ever noticed until now. Anyway, let's bury that idiocy now that it got noticed. 17 years is long enough... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* Merge commit 'ccbf62d8a284cf181ac28c8e8407dd077d90dd4b' into for-nextAl Viro2014-08-0775-1355/+2507
|\ | | | | | | backmerge to avoid kernel/acct.c conflict
| * sched: Make task->start_time nanoseconds basedThomas Gleixner2014-07-234-19/+14
| | | | | | | | | | | | | | Simplify the timespec to nsec/usec conversions. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * sched: Make task->real_start_time nanoseconds basedThomas Gleixner2014-07-233-9/+3
| | | | | | | | | | | | | | | | Simplify the only user of this data by removing the timespec conversion. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * time: Export nsecs_to_jiffies()Thomas Gleixner2014-07-231-0/+1
| | | | | | | | | | | | | | Required for moving drivers to the nanosecond based interfaces. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * timekeeping: Provide ktime_get[*]_ns() helpersThomas Gleixner2014-07-231-0/+15
| | | | | | | | | | | | | | | | A lot of code converts either timespecs or ktime_t to nanoseconds. Provide helper functions. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * timekeeping: Remove ktime_get_monotonic_offset()Thomas Gleixner2014-07-232-19/+0
| | | | | | | | | | | | | | No more users. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * drm: Use ktime_mono_to_real()Thomas Gleixner2014-07-231-13/+3
| | | | | | | | | | | | | | | | | | | | | | | | Convert the monotonic timestamp with ktime_mono_to_real() in drm_calc_vbltimestamp_from_scanoutpos(). In get_drm_timestamp we can call either ktime_get() or ktime_get_real() depending on drm_timestamp_monotonic. No point in having two calls into the core for CLOCK_REALTIME. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * input: evdev: Use ktime_mono_to_real()Thomas Gleixner2014-07-231-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | Convert the monotonic timestamp with ktime_mono_to_real() in evdev_events(). In evdev_queue_syn_dropped() we can call either ktime_get() or ktime_get_real() depending on the clkid. No point in having two calls for CLOCK_REALTIME. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * timerfd: Use ktime_mono_to_real()Thomas Gleixner2014-07-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | We have a few other use cases of ktime_get_monotonic_offset() which can be optimized with ktime_mono_to_real(). The timerfd code uses the offset only for comparison, so we can use ktime_mono_to_real(0) for this as well. Funny enough text size shrinks with that on ARM and x8664 !? Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * timekeeping: Provide ktime_mono_to_any()Thomas Gleixner2014-07-232-0/+29
| | | | | | | | | | | | | | | | ktime based conversion function to map a monotonic time stamp to a different CLOCK. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * timekeeping; Use ktime based data for ktime_get_update_offsets_tick()Thomas Gleixner2014-07-231-6/+6
| | | | | | | | | | | | | | No need to juggle with timespecs. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * timekeeping: Use ktime_t data for ktime_get_update_offsets_now()Thomas Gleixner2014-07-231-6/+4
| | | | | | | | | | | | | | No need to juggle with timespecs. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * timekeeping: Use ktime_t based data for ktime_get_clocktai()Thomas Gleixner2014-07-232-16/+8
| | | | | | | | | | Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * timekeeping; Use ktime_t based data for ktime_get_boottime()Thomas Gleixner2014-07-232-18/+11
| | | | | | | | | | Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * timekeeping: Use ktime_t based data for ktime_get_real()Thomas Gleixner2014-07-232-16/+8
| | | | | | | | | | | | | | Speed up the readout. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * timekeeping: Provide ktime_get_with_offset()Thomas Gleixner2014-07-232-0/+36
| | | | | | | | | | | | | | | | Provide a helper function which lets us implement ktime_t based interfaces for real, boot and tai clocks. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * timekeeping: Use ktime_t based data for ktime_get()Thomas Gleixner2014-07-231-4/+5
| | | | | | | | | | | | | | | | Speed up ktime_get() by using ktime_t based data. Text size shrinks by 64 bytes on x8664. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * timekeeping: Provide internal ktime_t based dataThomas Gleixner2014-07-232-0/+25
| | | | | | | | | | | | | | | | | | The ktime_t based interfaces are used a lot in performance critical code pathes. Add ktime_t based data so the interfaces don't have to convert from the xtime/timespec based data. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * timekeeping: Use timekeeping_update() instead of memcpy()Thomas Gleixner2014-07-231-2/+1
| | | | | | | | | | | | | | | | We already have a function which does the right thing, that also makes sure that the coming ktime_t based cached values are getting updated. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * timekeeping: Cache optimize struct timekeeperThomas Gleixner2014-07-232-126/+143
| | | | | | | | | | | | | | | | | | | | | | struct timekeeper is quite badly sorted for the hot readout path. Most time access functions need to load two cache lines. Rearrange it so ktime_get() and getnstimeofday() are happy with a single cache line. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * timekeeper: Move tk_xtime to core codeThomas Gleixner2014-07-232-45/+43
| | | | | | | | | | | | | | No users outside of the core. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * timekeeping: Provide timespec64 based interfacesThomas Gleixner2014-07-233-33/+87
| | | | | | | | | | | | | | | | To convert callers of the core code to timespec64 we need to provide the proper interfaces. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * time: Consolidate the time accessor prototypesThomas Gleixner2014-07-239-58/+111
| | | | | | | | | | | | | | | | | | Right now we have time related prototypes in 3 different header files. Move it to a single timekeeping header file and move the core internal stuff into a core private header. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * timekeeping: Convert timekeeping core to use timespec64sJohn Stultz2014-07-236-87/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | Convert the core timekeeping logic to use timespec64s. This moves the 2038 issues out of the core logic and into all of the accessor functions. Future changes will need to push the timespec64s out to all timekeeping users, but that can be done interface by interface. Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
| * time: More core infrastructure for timespec64John Stultz2014-07-233-0/+118
| | | | | | | | | | | | | | | | Helper and conversion functions for timespec64. Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
OpenPOWER on IntegriCloud