The fileserver will crash (assert) when writing the Symlink text fails because of e.g. ENOSPC.

Better log it and return an error to the user, in this case the most likely error (VDISKFULL) to be consistent with e.g. StoreData (although that may not be the real reason).

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rainer Toebbicke
European Laboratory for Particle Physics(CERN) - Geneva, Switzerland
Phone: +41 22 767 8985       Fax: +41 22 767 7155

*** openafs/src/viced/afsfileprocs.c.2rig       2005-04-06 10:32:03.000000000 
+0200
--- openafs/src/viced/afsfileprocs.c    2005-04-19 14:33:49.000000000 +0200
***************
*** 4218,4224 ****
      Vnode *targetptr = 0;     /* vnode of the new link */
      Vnode *parentwhentargetnotdir = 0;        /* parent for use in 
SetAccessList */
      int errorCode = 0;                /* error code */
!     int code = 0;
      DirHandle dir;            /* Handle for dir package I/O */
      Volume *volptr = 0;               /* pointer to the volume header */
      struct client *client;    /* pointer to client structure */
--- 4218,4224 ----
      Vnode *targetptr = 0;     /* vnode of the new link */
      Vnode *parentwhentargetnotdir = 0;        /* parent for use in 
SetAccessList */
      int errorCode = 0;                /* error code */
!     int len, code = 0;
      DirHandle dir;            /* Handle for dir package I/O */
      Volume *volptr = 0;               /* pointer to the volume header */
      struct client *client;    /* pointer to client structure */
***************
*** 4309,4316 ****
      /* Write the contents of the symbolic link name into the target inode */
      fdP = IH_OPEN(targetptr->handle);
      assert(fdP != NULL);
!     assert(FDH_WRITE(fdP, (char *)LinkContents, strlen((char *)LinkContents))
!          == strlen((char *)LinkContents));
      FDH_CLOSE(fdP);
      /*
       * Set up and return modified status for the parent dir and new symlink
--- 4309,4318 ----
      /* Write the contents of the symbolic link name into the target inode */
      fdP = IH_OPEN(targetptr->handle);
      assert(fdP != NULL);
!     len = strlen((char *) LinkContents);
!     code = (len == FDH_WRITE(fdP, (char *) LinkContents, len)) ? 0 : 
VDISKFULL;
!     if (code) ViceLog(0, ("SAFSS_Symlink FDH_WRITE failed for len=%d, 
Fid=%u.%d.%d\n",
!               len, OutFid->Volume, OutFid->Vnode, OutFid->Unique));
      FDH_CLOSE(fdP);
      /*
       * Set up and return modified status for the parent dir and new symlink
***************
*** 4334,4340 ****
                           volptr);
      FidZap(&dir);
      ViceLog(2, ("SAFS_Symlink returns %d\n", errorCode));
!     return errorCode;
  
  }                             /*SAFSS_Symlink */
  
--- 4334,4340 ----
                           volptr);
      FidZap(&dir);
      ViceLog(2, ("SAFS_Symlink returns %d\n", errorCode));
!     return ( errorCode ? errorCode : code );
  
  }                             /*SAFSS_Symlink */
  

Reply via email to