All of lore.kernel.org
 help / color / mirror / Atom feed
* handle_async_copy calling kzalloc under spinlock
@ 2018-11-16 14:26 J. Bruce Fields
       [not found] ` <CAN-5tyGsDAd2hkaw5nONdS2TzRy1qK7xyFDpNeT7Jsd9ZrH7+g@mail.gmail.com>
  0 siblings, 1 reply; 9+ messages in thread
From: J. Bruce Fields @ 2018-11-16 14:26 UTC (permalink / raw)
  To: Olga Kornievskaia; +Cc: linux-nfs, Anna Schumaker

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.

--b.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-11-19 21:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-16 14:26 handle_async_copy calling kzalloc under spinlock J. Bruce Fields
     [not found] ` <CAN-5tyGsDAd2hkaw5nONdS2TzRy1qK7xyFDpNeT7Jsd9ZrH7+g@mail.gmail.com>
2018-11-16 17:56   ` J. Bruce Fields
2018-11-16 18:01     ` J. Bruce Fields
2018-11-16 18:30       ` Olga Kornievskaia
     [not found]         ` <CAN-5tyHX3h6TXJhFeZPGZvAWXXxwaxpAkZtRNV9+L8m5xJ3fVw@mail.gmail.com>
2018-11-16 19:30           ` J. Bruce Fields
2018-11-16 19:49             ` Olga Kornievskaia
2018-11-16 19:58               ` J. Bruce Fields
2018-11-16 20:11                 ` Olga Kornievskaia
2018-11-19 21:05                   ` J. Bruce Fields

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.