Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libperfuse One more explicit error log, and two bug fixes
details: https://anonhg.NetBSD.org/src/rev/df8b6d134ad5
branches: trunk
changeset: 788684:df8b6d134ad5
user: manu <manu%NetBSD.org@localhost>
date: Thu Jul 18 09:01:20 2013 +0000
description:
One more explicit error log, and two bug fixes
1) with recent FUSE, when lookup returns a null ino, it means ENOENT
2) odd corner case that caused a bug on dd if=test of=test conv=notrunc
This caused the file to be open first ro, then rw. A logic bug in
perfuse_node_open caused it to skip the second operation, whereas
it should open for writing, and store the write FH without touching
the read FH.
diffstat:
lib/libperfuse/ops.c | 33 ++++++++++++++++++++++++++-------
1 files changed, 26 insertions(+), 7 deletions(-)
diffs (54 lines):
diff -r ba6bdb646c00 -r df8b6d134ad5 lib/libperfuse/ops.c
--- a/lib/libperfuse/ops.c Thu Jul 18 07:59:44 2013 +0000
+++ b/lib/libperfuse/ops.c Thu Jul 18 09:01:20 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ops.c,v 1.60 2012/11/03 15:43:20 manu Exp $ */
+/* $NetBSD: ops.c,v 1.61 2013/07/18 09:01:20 manu Exp $ */
/*-
* Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -1369,10 +1369,29 @@
* Do not open twice, and do not reopen for reading
* if we already have write handle.
*/
- if (((mode & FREAD) && (pnd->pnd_flags & PND_RFH)) ||
- ((mode & FREAD) && (pnd->pnd_flags & PND_WFH)) ||
- ((mode & FWRITE) && (pnd->pnd_flags & PND_WFH)))
- goto out;
+ switch (mode & (FREAD|FWRITE)) {
+ case FREAD:
+ if (pnd->pnd_flags & (PND_RFH|PND_WFH))
+ goto out;
+ break;
+ case FWRITE:
+ if (pnd->pnd_flags & PND_WFH)
+ goto out;
+ break;
+ case FREAD|FWRITE:
+ if (pnd->pnd_flags & PND_WFH)
+ goto out;
+
+ /*
+ * Corner case: if already open for reading (PND_RFH)
+ * and re-opening FREAD|FWRITE, we need to reopen,
+ * but only for writing. Note the change on mode
+ * will only affect perfuse_new_fh()
+ */
+ if (pnd->pnd_flags & PND_RFH)
+ mode &= ~FREAD;
+ break;
+ }
/*
* Queue open on a node so that we do not open
@@ -2723,8 +2742,8 @@
#ifdef PERFUSE_DEBUG
if ((pnd->pnd_flags & PND_OPEN) ||
!TAILQ_EMPTY(&pnd->pnd_pcq))
- DERRX(EX_SOFTWARE, "%s: opc = %p: still open",
- __func__, opc);
+ DERRX(EX_SOFTWARE, "%s: opc = %p \"%s\": still open",
+ __func__, opc, pnd->pnd_name);
if ((pnd->pnd_flags & PND_BUSY) ||
!TAILQ_EMPTY(&pnd->pnd_pcq))
Home |
Main Index |
Thread Index |
Old Index