lkml.org 
[lkml]   [2020]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] files: rcu free files_struct
Matthew Wilcox <willy@infradead.org> writes:

> On Wed, Dec 09, 2020 at 12:04:38PM -0600, Eric W. Biederman wrote:
>> @@ -397,8 +397,9 @@ static struct fdtable *close_files(struct files_struct * files)
>> set = fdt->open_fds[j++];
>> while (set) {
>> if (set & 1) {
>> - struct file * file = xchg(&fdt->fd[i], NULL);
>> + struct file * file = fdt->fd[i];
>> if (file) {
>> + rcu_assign_pointer(fdt->fd[i], NULL);
>
> Assuming this is safe, you can use RCU_INIT_POINTER() here because you're
> storing NULL, so you don't need the wmb() before storing the pointer.

Thanks. I was remembering there was a special case like and I had
forgotten what the rule was.

Eric

\
 
 \ /
  Last update: 2020-12-09 23:11    [W:1.850 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site