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

            [LU-3832] osc_io_read_start() ignores O_NOATIME, updates i_atime
            jhammond John Hammond made changes -
            Status Original: Resolved [ 5 ] New: Closed [ 6 ]
            jhammond John Hammond made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: In Progress [ 3 ] New: Resolved [ 5 ]
            jhammond John Hammond added a comment -

            Patch landed to master.

            jhammond John Hammond added a comment - Patch landed to master.
            jhammond John Hammond made changes -
            Link New: This issue is related to LU-3868 [ LU-3868 ]
            jhammond John Hammond made changes -
            Status Original: Open [ 1 ] New: In Progress [ 3 ]
            jhammond John Hammond added a comment -

            The rules used in file_accessed() and touch_atime() have been incorporated into the ci_noatime setting logic.

            jhammond John Hammond added a comment - The rules used in file_accessed() and touch_atime() have been incorporated into the ci_noatime setting logic.
            jhammond John Hammond made changes -
            Parent New: LU-3647 [ 20020 ]
            Severity Original: 3 [ 10022 ]
            Issue Type Original: Bug [ 1 ] New: Technical task [ 7 ]
            jhammond John Hammond made changes -
            Parent Original: LU-3814 [ 20551 ]
            Severity New: 3 [ 10022 ]
            Issue Type Original: Technical task [ 7 ] New: Bug [ 1 ]
            jlevi Jodi Levi (Inactive) made changes -
            Fix Version/s New: Lustre 2.5.0 [ 10295 ]
            Priority Original: Blocker [ 1 ] New: Critical [ 2 ]
            jhammond John Hammond added a comment -

            Also note that the kernel's file_accessed() has a more complicated set of rules (including checking the SB for noatime) which should be incorporated into ll_io_init() at some point.

            jhammond John Hammond added a comment - Also note that the kernel's file_accessed() has a more complicated set of rules (including checking the SB for noatime) which should be incorporated into ll_io_init() at some point.

            People

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

              Dates

                Created:
                Updated:
                Resolved: