Re: [PATCH 1/6] nfs: "open code" the NFS direct write rescheduler



Chuck Lever <cel@xxxxxxxxxxxxxx> wrote:

Andrew Morton wrote:
Chuck Lever <cel@xxxxxxxxxx> wrote:
+ * Prevent I/O completion while we're still rescheduling
+ */
+ dreq->outstanding++;
+

No locking.

dreq->count = 0;
+ list_for_each(pos, &dreq->rewrite_list) {
+ struct nfs_write_data *data =
+ list_entry(dreq->rewrite_list.next, struct nfs_write_data, pages);
+
+ spin_lock(&dreq->lock);
+ dreq->outstanding++;
+ spin_unlock(&dreq->lock);

Locking.

Deliberate?

Yes. At the top of the loop, there is no outstanding I/O, so no locking
is needed while updating "outstanding." Inside the loop, we've
dispatched some I/O against "dreq" so locking is needed to ensure
outstanding is updated properly.


OK. Well if I asked, then others will wonder about it. A comment would
cure that problem ;)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: [PATCH 1/6] nfs: "open code" the NFS direct write rescheduler
    ... No locking. ... At the top of the loop, there is no outstanding I/O, so no locking is needed while updating "outstanding." ... Inside the loop, we've dispatched some I/O against "dreq" so locking is needed to ensure outstanding is updated properly. ...
    (Linux-Kernel)
  • Re: Concurrent access to /dev/urandom
    ... the problem is that the locking was ... and not in the extract_entropy loop. ... I'm currently travelling so I can't easily test this patch, ... where applications would be calling them in tight loops on threaded ...
    (Linux-Kernel)
  • Re: [PATCH] drivers/block/ub.c: use list_for_each_entry()
    ... I think I disagree with this reasoning. ... If you write your own for loop, ... of security by the _safe suffix and getting their locking wrong. ...
    (Linux-Kernel)
  • Re: awt canvas on a swing form okay?
    ... >> suggests not) If not why keep looping? ... Locking out how? ... Unless that is he has taken care ... to check for events each time around the loop or has a multithreaded ...
    (comp.lang.java.gui)
  • Re: VBA Loop
    ... set of orders that are associated with the current job and is outstanding. ... Loop through this recordset until EOF. ... I want to create a seperate email for each job ...
    (microsoft.public.access.modulesdaovba)