Re: handle_async_copy calling kzalloc under spinlock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 16, 2018 at 11:25:50AM -0500, Olga Kornievskaia wrote:
> On Fri, Nov 16, 2018 at 9:27 AM J. Bruce Fields <bfields@xxxxxxxxxxxx>
> wrote:
> 
> > From bc0c9079b48d "NFS handle COPY reply CB_OFFLOAD call race":
> >
> > +       spin_lock(&server->nfs_client->cl_lock);
> > +       list_for_each_entry(copy, &server->nfs_client->pending_cb_stateids,
> > +                               copies) {
> > +               if (memcmp(&res->write_res.stateid, &copy->stateid,
> > +                               NFS4_STATEID_SIZE))
> > +                       continue;
> > +               found_pending = true;
> > +               list_del(&copy->copies);
> > +               break;
> > +       }
> > +       if (found_pending) {
> > +               spin_unlock(&server->nfs_client->cl_lock);
> > +               goto out;
> > +       }
> >
> >         copy = kzalloc(sizeof(struct nfs4_copy_state), GFP_NOFS);
> >
> > At this point we're still holding cl_lock.
> >
> > Best might be to allocate "copy" before taking the lock, then free it on
> > any
> > paths where we don't end up needing it.
> >
> >
> Thanks. I'll do that.

Thanks.  And, I just noticed--nfs4_callback_offload has the same
problem.

--b.



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux