There could be a race between page write and inode free, hold
a cl_object reference during the IO lest accessing freed object.
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: Ic70cc27430e68265aba0662fc68e9bfe2f86cfe1
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53819
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
io = vvp_env_thread_io(env);
io->ci_obj = ll_i2info(inode)->lli_clob;
+ cl_object_get(io->ci_obj);
io->ci_ignore_layout = ignore_layout;
/* initialize parameters for sync */
if (result == 0)
result = fio->fi_nr_written;
cl_io_fini(env, io);
+ cl_object_put(env, io->ci_obj);
cl_env_put(env, &refcheck);
RETURN(result);
#endif
}
- if (ll_i2info(inode)->lli_clob == NULL)
+ if (ll_i2info(inode)->lli_clob == NULL || (inode->i_state & I_FREEING))
RETURN(0);
/* for directio, it would call writepages() to evict cached pages