Re: [RFC][PATCH 04/42] make get_empty_filp() to call file_free_rcu() directly

2018-07-10 Thread Al Viro
On Tue, Jul 10, 2018 at 07:35:23PM -0700, Linus Torvalds wrote: > This one looked odd to me. > > Then I saw 5/42, and it made more sense. > > I think the explanation is a bit misleading. Technically correct, but > not *why* you did it. Probably should fold these two together, now that reordering

Re: [RFC][PATCH 04/42] make get_empty_filp() to call file_free_rcu() directly

2018-07-10 Thread Linus Torvalds
This one looked odd to me. Then I saw 5/42, and it made more sense. I think the explanation is a bit misleading. Technically correct, but not *why* you did it. Linus

[RFC][PATCH 04/42] make get_empty_filp() to call file_free_rcu() directly

2018-07-10 Thread Al Viro
@@ struct file *get_empty_filp(void) if (unlikely(!f)) return ERR_PTR(-ENOMEM); - percpu_counter_inc(&nr_files); f->f_cred = get_cred(cred); error = security_file_alloc(f); if (unlikely(error)) { - file

[RFC][PATCH 09/42] pass creds to get_empty_filp(), make sure dentry_open() passes the right creds

2018-07-10 Thread Al Viro
From: Al Viro ... and rename get_empty_filp() to alloc_empty_file(). dentry_open() gets creds as argument, but the only thing that sees those is security_file_open() - file->f_cred still ends up with current_cred(). For almost all callers it's the same thing, but there are several brok

Re: [PATCH] vfs:Fix kmemleak in get_empty_filp on error path if security_file_alloc fails

2016-07-16 Thread Al Viro
007f6073fc3780() GS:8801c740() > knlGS: > [ 402.117062] CS: 0010 DS: ES: CR0: 80050033 > [ 402.955591] CR2: 8801c7060c90 CR3: a88f1000 CR4: > 000406f0 > [ 403.807725] [] get_empty_filp+0x58/0x1b0 > [ 404.6619

Re: [PATCH] vfs: Don't leak a path when get_empty_filp in dentry_open

2014-01-16 Thread Eric W. Biederman
Al Viro writes: > On Thu, Jan 16, 2014 at 03:45:38PM -0800, Eric W. Biederman wrote: >> >> Normally in dentry_open the passed in path is placed on the new filp >> removing the caller from needing to worry about it. In the rare case >> that we can not allocate a filp the path is not consumed. N

Re: [PATCH] vfs: Don't leak a path when get_empty_filp in dentry_open

2014-01-16 Thread Al Viro
On Thu, Jan 16, 2014 at 03:45:38PM -0800, Eric W. Biederman wrote: > > Normally in dentry_open the passed in path is placed on the new filp > removing the caller from needing to worry about it. In the rare case > that we can not allocate a filp the path is not consumed. None of the > callers of

[PATCH] vfs: Don't leak a path when get_empty_filp in dentry_open

2014-01-16 Thread Eric W. Biederman
Normally in dentry_open the passed in path is placed on the new filp removing the caller from needing to worry about it. In the rare case that we can not allocate a filp the path is not consumed. None of the callers of dentry_open call path_put in their error handling when dentry_open fails so c

Re: [PATCH] fs: Preserve error code in get_empty_filp()

2013-02-21 Thread Theodore Ts'o
> > A little bit of context for this change. We at Google work on a test > > framework that shows how kernel behaves under memory pressure. In the > > codepath that I am fixing the syscalls return ENFILE error, but in > > fact the correct error would be ENOMEM. get_empty_fi

Re: [PATCH] fs: Preserve error code in get_empty_filp()

2013-02-14 Thread Al Viro
kernel behaves under memory pressure. In the > codepath that I am fixing the syscalls return ENFILE error, but in > fact the correct error would be ENOMEM. get_empty_filp() should > preserve the original error and not to replace all errors with ENFILE. The trouble is, you are introducin

Re: [PATCH] fs: Preserve error code in get_empty_filp()

2012-10-05 Thread Theodore Ts'o
kernel behaves under memory pressure. In the > codepath that I am fixing the syscalls return ENFILE error, but in > fact the correct error would be ENOMEM. get_empty_filp() should > preserve the original error and not to replace all errors with ENFILE. Anatol, I suggest that you rebase

Re: [PATCH] fs: Preserve error code in get_empty_filp()

2012-10-05 Thread Anatol Pomozov
error, but in fact the correct error would be ENOMEM. get_empty_filp() should preserve the original error and not to replace all errors with ENFILE. On Wed, Sep 12, 2012 at 8:11 PM, Anatol Pomozov wrote: > Allocating a file structure in function get_empty_filp() might fail because > of several r

[PATCH] fs: Preserve error code in get_empty_filp()

2012-09-12 Thread Anatol Pomozov
Allocating a file structure in function get_empty_filp() might fail because of several reasons: - not enough memory for file structures - operation is not allowed - user is over its limit Currently the function returns NULL in all cases and we loose the exact reason of the error. All callers

Re: [PATCH] fs: Preserve error code in get_empty_filp()

2012-09-04 Thread Anatol Pomozov
Hi, Al Do you have some time to review this change? Does it look good? On Thu, Aug 2, 2012 at 5:47 PM, Anatol Pomozov wrote: > Allocating a file structure in function get_empty_filp() might fail because > of several reasons: > - not enough memory for file structures > - oper

Re: [PATCH] fs: Preserve error code in get_empty_filp()

2012-08-21 Thread Anatol Pomozov
Hi On Tue, Aug 21, 2012 at 3:06 AM, Jan Engelhardt wrote: > > > On Wednesday 2012-08-01 20:19, anatol.pomo...@gmail.com wrote: > >Allocating a file structure in function get_empty_filp() might fail > > because > >of several reasons: > > - not enough memory for f

Re: [PATCH] fs: Preserve error code in get_empty_filp()

2012-08-21 Thread Jan Engelhardt
On Wednesday 2012-08-01 20:19, anatol.pomo...@gmail.com wrote: >Allocating a file structure in function get_empty_filp() might fail because >of several reasons: > - not enough memory for file structures > - operation is not allowed > - user is over its limit > >Currently the

[PATCH] fs: Preserve error code in get_empty_filp()

2012-08-02 Thread Anatol Pomozov
Allocating a file structure in function get_empty_filp() might fail because of several reasons: - not enough memory for file structures - operation is not allowed - user is over its limit Currently the function returns NULL in all cases and we loose the exact reason of the error. All callers

Re: [PATCH] fs: Preserve error code in get_empty_filp()

2012-08-02 Thread Anatol Pomozov
Hi Current HEAD contains conflicting changes in fs/pipe.c. I am going to rebase my patch and resend it. On Wed, Aug 1, 2012 at 11:34 AM, wrote: > From: Anatol Pomazau > > Allocating a file structure in function get_empty_filp() might fail because > of several reasons: > - no

[PATCH] fs: Preserve error code in get_empty_filp()

2012-08-01 Thread anatol . pomozov
From: Anatol Pomazau Allocating a file structure in function get_empty_filp() might fail because of several reasons: - not enough memory for file structures - operation is not allowed - user is over its limit Currently the function returns NULL in all cases and we loose the exact reason of

[PATCH] fs: Preserve error code in get_empty_filp()

2012-08-01 Thread anatol . pomozov
From: Anatol Pomazau Allocating a file structure in function get_empty_filp() might fail because of several reasons: - not enough memory for file structures - operation is not allowed - user is over its limit Currently the function returns NULL in all cases and we loose the exact reason of

Re: [patch-2.4.0-test12-pre5] optimized get_empty_filp()

2000-12-05 Thread Tigran Aivazian
On Tue, 5 Dec 2000, Peter Samuelson wrote: > The question is whether or not it is worth taking a lock again (with > that non-zero cost) to achieve the gain of doing the 92-byte memset and > the atomic_set in parallel with other CPUs. In other words, by locking > and unlocking twice, you reduce th

Re: [patch-2.4.0-test12-pre5] optimized get_empty_filp()

2000-12-05 Thread Peter Samuelson
[Peter Samuelson] > > Whether a memset of 92 bytes (on 32-bit arch), plus an > > atomic_set(), are worth deserializing, I do not know. [Tigran Aivazian] > Of course, they are worth it. Actually, I don't understand how can > you even doubt it? Clearly we are talking at cross-purposes here. I

Re: [patch-2.4.0-test12-pre5] optimized get_empty_filp()

2000-12-05 Thread Tigran Aivazian
On Tue, 5 Dec 2000, Peter Samuelson wrote: > [Tigran Aivazian] > > The only reason one could think of was to "hold the lock for as short > > time as possible" but a minute's thought reveals that such reason is > > invalid (i.e. one is more likely to waste time spinning on the lock > > than to save

Re: [patch-2.4.0-test12-pre5] optimized get_empty_filp()

2000-12-05 Thread Peter Samuelson
[Tigran Aivazian] > The only reason one could think of was to "hold the lock for as short > time as possible" but a minute's thought reveals that such reason is > invalid (i.e. one is more likely to waste time spinning on the lock > than to save it by dropping/retaking it, given the relative dura

[patch-2.4.0-test12-pre5] optimized get_empty_filp()

2000-12-05 Thread Tigran Aivazian
Hi Linus, It is quite clear that dropping and retaking the files_lock in fs/file_table.c:get_empty_filp() at the label new_one is absolutely unnecessary. The only reason one could think of was to "hold the lock for as short time as possible" but a minute's thought reveals that such reason is inva

get_empty_filp

2000-10-02 Thread Lee Chin
Hello All, I am seeing a bug in get_empty_filp (fs/file_table.c) where files_stat.nr_free_files is out of sync with respect to the actual number of elements in free_list. More precicely, for some reason, free_list became empty (free_list.next and free_list.prev pointed back to free_list) but