Subject: [nfsv4] LAYOUTRETURN and error codes

From: Tom Haynes <[email-masked]>
Date: Thu, 3 May 2012 14:09:36 -0700

Andy,

I've got some old slides in front of me and they state that the LAYOUTRETURN is to
set an error code per DS. In that scenario, each DS in the layout MUST get a status
code.

I think I made an incorrect assumption in those slides and I'll try to prove it
below.

  4222     struct layoutreturn_device_error4 {
  4223             deviceid4       lrde_deviceid;
  4224             nfsstat4        lrde_status;
  4225             nfs_opnum4      lrde_opnum;
  4226     };
  4227
  4228     struct layoutreturn_error_report4 {
  4229             layoutreturn_device_error4      lrer_errors<>;
  4230     };

If we look at the .x document, we also see:

   /// %/*
   /// % * Encoded in the lrf_body field of
   /// % * data type layoutreturn_file4:
   /// % */

So

   /// struct layoutreturn_file4 {
   ///         offset4         lrf_offset;
   ///         length4         lrf_length;
   ///         stateid4        lrf_stateid;
   /// %       /* layouttype4 specific data */
   ///         opaque          lrf_body<>;
   /// };

For the corresponding error structure in the Objects, we have:

   /// struct pnfs_osd_ioerr4 {
   ///     pnfs_osd_objid4     oer_component;
   ///     length4             oer_comp_offset;
   ///     length4             oer_comp_length;
   ///     bool                oer_iswrite;
   ///     pnfs_osd_errno4     oer_errno;
   /// };
   ///

   /// struct pnfs_osd_layoutreturn4 {
   ///     pnfs_osd_ioerr4             olr_ioerr_report<>;
   /// };
   ///

Section 8.3 of RFC5664 explains that:

	Each element in the array represents an error
   	that occurred on the object specified by oer_component.

And further, the allowed errors are:

   /// enum pnfs_osd_errno4 {
   ///     PNFS_OSD_ERR_EIO            = 1,
   ///     PNFS_OSD_ERR_NOT_FOUND      = 2,
   ///     PNFS_OSD_ERR_NO_SPACE       = 3,
   ///     PNFS_OSD_ERR_BAD_CRED       = 4,
   ///     PNFS_OSD_ERR_NO_ACCESS      = 5,
   ///     PNFS_OSD_ERR_UNREACHABLE    = 6,
   ///     PNFS_OSD_ERR_RESOURCE       = 7
   /// };
   ///

So for the Objects, only components in error are reported and there is no
ability to report an OK status.

So, we need to remove NFS4_OK from the section.

I was going to claim we also needed a statement akin to oer_component, but it
turns out we already have it:

  4248     field references a layoutreturn_device_error4, which contains an
  4249     array of layoutreturn_device_error4.

Thanks for catching this one!
Tom

-- 
[email-masked], ex-cfb