HSM _not only_ small fixes and to do list goes here (LU-3647)

[LU-3832] osc_io_read_start() ignores O_NOATIME, updates i_atime Created: 23/Aug/13  Updated: 30/Aug/13  Resolved: 30/Aug/13

Status: Closed
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.5.0
Fix Version/s: Lustre 2.5.0

Type: Technical task Priority: Critical
Reporter: John Hammond Assignee: John Hammond
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Related
is related to LU-3868 lockless IO does not update inode tim... Resolved
Rank (Obsolete): 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?



 Comments   
Comment by Jinshan Xiong (Inactive) [ 23/Aug/13 ]

Yes, the first cl_object_attr_get() is not necessary.

Comment by John Hammond [ 23/Aug/13 ]

Please see http://review.whamcloud.com/7442.

Comment by John Hammond [ 23/Aug/13 ]

This partially addresses some HSM test failures: test 24 requires that archive and release not change the atime.

Comment by John Hammond [ 23/Aug/13 ]

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.

Comment by John Hammond [ 30/Aug/13 ]

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

Comment by John Hammond [ 30/Aug/13 ]

Patch landed to master.

Generated at Sat Feb 10 01:37:17 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.