Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-3647 HSM _not only_ small fixes and to do list goes here
  3. LU-3832

osc_io_read_start() ignores O_NOATIME, updates i_atime

    XMLWordPrintable

Details

    • Technical task
    • Resolution: Fixed
    • Critical
    • Lustre 2.5.0
    • Lustre 2.5.0
    • None
    • 9904

    Description

      I find two issues with osc_io_read_start(). It updates the i_atime without checking O_NOATIME in f_flags. It calls cl_object_attr_get() for no reason that I can discern.

      static int osc_io_read_start(const struct lu_env *env,
                                   const struct cl_io_slice *slice)
      {
              struct osc_io    *oio   = cl2osc_io(env, slice);
              struct cl_object *obj   = slice->cis_obj;
              struct cl_attr   *attr  = &osc_env_info(env)->oti_attr;
              int              result = 0;
              ENTRY;
      
              if (oio->oi_lockless == 0) {
                      cl_object_attr_lock(obj);
                      result = cl_object_attr_get(env, obj, attr);
                      if (result == 0) {
                              attr->cat_atime = LTIME_S(CFS_CURRENT_TIME);
                              result = cl_object_attr_set(env, obj, attr,
                                                          CAT_ATIME);
                      }
                      cl_object_attr_unlock(obj);
              }
              RETURN(result);
      }
      

      The upper layer will also update i_atime if this is appropriate, so I propose adding a noatime bit to struct cl_io and only updating the LVB atime for the current OSC object if that bit is set.

      osc_io_write_start() similarly calls cl_object_attr_get() before doing

              attr->cat_mtime = attr->cat_ctime =
                                      LTIME_S(CFS_CURRENT_TIME);
              result = cl_object_attr_set(env, obj, attr,
                                          CAT_MTIME | CAT_CTIME);
      

      I cannot find any reason for first calling cl_object_attr_get() here. Am I missing something?

      Attachments

        Issue Links

          Activity

            People

              jhammond John Hammond
              jhammond John Hammond
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: