viced: Do not offline volume on successful IH_DEC
authorAndrew Deason <adeason@sinenomine.net>
Thu, 5 Apr 2012 22:55:17 +0000 (17:55 -0500)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 6 Apr 2012 00:26:15 +0000 (17:26 -0700)
If we fail to CoW a file due to ENOSPC, we try to IH_DEC the new file
copy, and if IH_DEC fails, we take the volume offline for salvaging.
But IH_DEC returns 0 on success, not on error. So take the salvaging
path when we get non-zero.

Change-Id: I4f0276fd4f077ca42087e92af8ba77b4e5347422
Reviewed-on: http://gerrit.openafs.org/7054
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

src/viced/afsfileprocs.c

index f759541..0d8857f 100644 (file)
@@ -1326,7 +1326,7 @@ CopyOnWrite(Vnode * targetptr, Volume * volptr, afs_foff_t off, afs_fsize_t len)
                IH_RELEASE(newH);
                FDH_REALLYCLOSE(targFdP);
                rc = IH_DEC(V_linkHandle(volptr), ino, V_parentId(volptr));
-               if (!rc) {
+               if (rc) {
                    ViceLog(0,
                            ("CopyOnWrite failed: error %u after i_dec on disk full, volume %u in partition %s needs salvage\n",
                             rc, V_id(volptr), volptr->partition->name));