Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/lib/libperfuse Pull up following revision(s) (requested b...
details: https://anonhg.NetBSD.org/src/rev/dc8c938bd091
branches: netbsd-6
changeset: 776407:dc8c938bd091
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Tue Jul 30 04:05:32 2013 +0000
description:
Pull up following revision(s) (requested by manu in ticket #923):
lib/libperfuse/ops.c: revision 1.61
lib/libperfuse/ops.c: revision 1.62
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.
Catch open without FREAD|FWRITE (it should not happen)
diffstat:
lib/libperfuse/ops.c | 35 +++++++++++++++++++++++++++++------
1 files changed, 29 insertions(+), 6 deletions(-)
diffs (57 lines):
diff -r f69007117e30 -r dc8c938bd091 lib/libperfuse/ops.c
--- a/lib/libperfuse/ops.c Tue Jul 30 04:00:20 2013 +0000
+++ b/lib/libperfuse/ops.c Tue Jul 30 04:05:32 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ops.c,v 1.50.2.6 2012/08/12 13:13:20 martin Exp $ */
+/* $NetBSD: ops.c,v 1.50.2.7 2013/07/30 04:05:32 msaitoh Exp $ */
/*-
* Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -1359,10 +1359,33 @@
* 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)))
+ 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;
+ default:
+ DWARNX("open without either FREAD nor FWRITE");
+ error = EPERM;
goto out;
+ }
/*
* Queue open on a node so that we do not open
@@ -2713,8 +2736,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