gfs2: annotate i_gl with __rcu and convert to accessor helpers
PATCH v2 1/1 gfs2: annotate i_gl with __rcu and convert to accessor helpers
i_gl is assigned once at inode instantiation and only updated via rcu_assign_pointer() at evict time, but the member lacked the __rcu annotation, so rcu_dereference_check() and rcu_assign_pointer() made sparse report address-space errors.
Annotate the member and convert all readers to gfs2_inode_glock(), based on rcu_dereference_protected() since the pointer is stable for any live inode. The two gfs2_glock_get() instantiation sites now publish the new glock via rcu_assign_pointer() once it is private.
No functional changes intended.
---
v1 -> v2:
- Drop the casts; annotate i_gl with __rcu and convert all readers to gfs2_inode_glock() (rcu_dereference_protected), since the pointer is stable for any live inode.
- The two gfs2_glock_get() instantiation sites now publish via rcu_assign_pointer() once the glock is private.
- Sparse-clean: no longer trading two errors for 200 warnings.
fs/gfs2/acl.c +4 -4
@@ -67,8 +67,8 @@ struct posix_acl *gfs2_get_acl(struct inode *inode, int type, bool rcu)if (rcu)return ERR_PTR (-ECHILD ); -if (!gfs2_glock_is_locked_by_me (ip->i_gl)) { -int ret =gfs2_glock_nq_init (ip->i_gl,LM_ST_SHARED , +if (!gfs2_glock_is_locked_by_me (gfs2_inode_glock (ip))) { +int ret =gfs2_glock_nq_init (gfs2_inode_glock (ip),LM_ST_SHARED ,LM_FLAG_ANY , &gh);if (ret)return ERR_PTR (ret);
@@ -119,8 +119,8 @@ int gfs2_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,if (ret)return ret; -if (!gfs2_glock_is_locked_by_me (ip->i_gl)) { - ret =gfs2_glock_nq_init (ip->i_gl,LM_ST_EXCLUSIVE ,0 , &gh); +if (!gfs2_glock_is_locked_by_me (gfs2_inode_glock (ip))) { + ret =gfs2_glock_nq_init (gfs2_inode_glock (ip),LM_ST_EXCLUSIVE ,0 , &gh);if (ret) goto out; need_unlock = true;
fs/gfs2/aops.c +4 -4
@@ -111,7 +111,7 @@ static int __gfs2_jdata_write_folio(struct folio *folio, inode->i_sb->s_blocksize, BIT(BH_Dirty)|BIT(BH_Uptodate)); } -gfs2_trans_add_databufs (ip->i_gl, folio,0 ,folio_size (folio)); +gfs2_trans_add_databufs (gfs2_inode_glock (ip), folio,0 ,folio_size (folio)); }return gfs2_write_jdata_folio (folio, wbc); }
@@ -132,7 +132,7 @@ int gfs2_jdata_writeback(struct address_space *mapping, struct writeback_controlint error;BUG_ON (current->journal_info); -if (gfs2_assert_withdraw (sdp, ip->i_gl->gl_state ==LM_ST_EXCLUSIVE )) +if (gfs2_assert_withdraw (sdp,gfs2_inode_glock (ip)->gl_state ==LM_ST_EXCLUSIVE ))return 0 ;while ((folio =writeback_iter (mapping, wbc, folio, &error))) {
@@ -368,7 +368,7 @@ static int gfs2_jdata_writepages(struct address_space *mapping, ret =gfs2_write_cache_jdata (mapping, wbc);if (ret ==0 && wbc->sync_mode ==WB_SYNC_ALL ) { -gfs2_log_flush (sdp, ip->i_gl,GFS2_LOG_HEAD_FLUSH_NORMAL | +gfs2_log_flush (sdp,gfs2_inode_glock (ip),GFS2_LOG_HEAD_FLUSH_NORMAL |GFS2_LFC_JDATA_WPAGES ); ret =gfs2_write_cache_jdata (mapping, wbc); }
@@ -566,7 +566,7 @@ static sector_t gfs2_bmap(struct address_space *mapping, sector_t lblock)sector_t dblock =0 ;int error; - error =gfs2_glock_nq_init (ip->i_gl,LM_ST_SHARED ,LM_FLAG_ANY , &i_gh); + error =gfs2_glock_nq_init (gfs2_inode_glock (ip),LM_ST_SHARED ,LM_FLAG_ANY , &i_gh);if (error)return 0 ;
fs/gfs2/bmap.c +18 -18
@@ -78,7 +78,7 @@ static int gfs2_unstuffer_folio(struct gfs2_inode *ip, struct buffer_head *dibh,map_bh (bh, inode->i_sb, block);set_buffer_uptodate (bh); -gfs2_trans_add_data (ip->i_gl, bh); +gfs2_trans_add_data (gfs2_inode_glock (ip), bh); }else {folio_mark_dirty (folio);gfs2_ordered_add_inode (ip);
@@ -124,7 +124,7 @@ static int __gfs2_unstuff_inode(struct gfs2_inode *ip, struct folio *folio)/* Set up the pointer to the new block */ -gfs2_trans_add_meta (ip->i_gl, dibh); +gfs2_trans_add_meta (gfs2_inode_glock (ip), dibh); di = (struct gfs2_dinode *)dibh->b_data;gfs2_buffer_clear_tail (dibh,sizeof (struct gfs2_dinode ));
@@ -678,7 +678,7 @@ static int __gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap,BUG_ON (dibh ==NULL );BUG_ON (dblks <1 ); -gfs2_trans_add_meta (ip->i_gl, dibh); +gfs2_trans_add_meta (gfs2_inode_glock (ip), dibh);down_write (&ip->i_rw_mutex);
@@ -722,7 +722,7 @@ static int __gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap, }for (; i -1 < mp->mp_fheight - ip->i_height && n >0 ; i++, n--) -gfs2_indirect_init (mp, ip->i_gl, i,0 , bn++); +gfs2_indirect_init (mp,gfs2_inode_glock (ip), i,0 , bn++);if (i -1 == mp->mp_fheight - ip->i_height) { i--; gfs2_buffer_copy_tail(mp->mp_bh[i],
@@ -748,9 +748,9 @@ static int __gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap, fallthrough;/* To branching from existing tree */ case ALLOC_GROW_DEPTH :if (i >1 && i < mp->mp_fheight) -gfs2_trans_add_meta (ip->i_gl, mp->mp_bh[i-1 ]); +gfs2_trans_add_meta (gfs2_inode_glock (ip), mp->mp_bh[i-1 ]);for (; i < mp->mp_fheight && n >0 ; i++, n--) -gfs2_indirect_init (mp, ip->i_gl, i, +gfs2_indirect_init (mp,gfs2_inode_glock (ip), i, mp->mp_list[i-1 ], bn++);if (i == mp->mp_fheight) state =ALLOC_DATA ;
@@ -760,7 +760,7 @@ static int __gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap,case ALLOC_DATA :BUG_ON (n > dblks);BUG_ON (mp->mp_bh[end_of_metadata] ==NULL ); -gfs2_trans_add_meta (ip->i_gl, mp->mp_bh[end_of_metadata]); +gfs2_trans_add_meta (gfs2_inode_glock (ip), mp->mp_bh[end_of_metadata]); dblks = n; ptr =metapointer (end_of_metadata, mp); iomap->addr = bn << inode->i_blkbits;
@@ -993,7 +993,7 @@ static void gfs2_iomap_put_folio(struct inode *inode, loff_t pos,struct gfs2_sbd *sdp =GFS2_SB (inode);if (gfs2_is_jdata (ip) && !gfs2_is_stuffed (ip)) -gfs2_trans_add_databufs (ip->i_gl, folio, +gfs2_trans_add_databufs (gfs2_inode_glock (ip), folio,offset_in_folio (folio, pos), copied);
@@ -1196,7 +1196,7 @@ static int gfs2_iomap_end(struct inode *inode, loff_t pos, loff_t length,if (iomap->flags &IOMAP_F_SIZE_CHANGED )mark_inode_dirty (inode); -set_bit (GLF_DIRTY , &ip->i_gl->gl_flags); +set_bit (GLF_DIRTY , &gfs2_inode_glock (ip)->gl_flags);return 0 ; }
@@ -1413,7 +1413,7 @@ static int trunc_start(struct inode *inode, u64 newsize)if (error) goto out; -gfs2_trans_add_meta (ip->i_gl, dibh); +gfs2_trans_add_meta (gfs2_inode_glock (ip), dibh);if (gfs2_is_stuffed (ip))gfs2_buffer_clear_tail (dibh,sizeof (struct gfs2_dinode ) + newsize);
@@ -1585,7 +1585,7 @@ static int sweep_bh_for_rgrps(struct gfs2_inode *ip, struct gfs2_holder *rd_gh, goto out_unlock; } -gfs2_trans_add_meta (ip->i_gl, bh); +gfs2_trans_add_meta (gfs2_inode_glock (ip), bh); buf_in_tr = true; *p =0 ;if (bstart + blen == bn) {
@@ -1619,7 +1619,7 @@ static int sweep_bh_for_rgrps(struct gfs2_inode *ip, struct gfs2_holder *rd_gh,/* Every transaction boundary, we rewrite the dinode to keep its di_blocks current in case of failure. */ inode_set_mtime_to_ts (&ip->i_inode,inode_set_ctime_current (&ip->i_inode)); -gfs2_trans_add_meta (ip->i_gl, dibh); +gfs2_trans_add_meta (gfs2_inode_glock (ip), dibh);gfs2_dinode_out (ip, dibh->b_data);brelse (dibh);up_write (&ip->i_rw_mutex);
@@ -1831,7 +1831,7 @@ static int punch_hole(struct gfs2_inode *ip, u64 offset, u64 length)for (mp_h =0 ; mp_h < mp.mp_aheight -1 ; mp_h++) {metapointer_range (&mp, mp_h, start_list, start_aligned, end_list, end_aligned, &start, &end); -gfs2_metapath_ra (ip->i_gl, start, end); +gfs2_metapath_ra (gfs2_inode_glock (ip), start, end); }if (mp.mp_aheight == ip->i_height)
@@ -1951,7 +1951,7 @@ static int punch_hole(struct gfs2_inode *ip, u64 offset, u64 length) start_list, start_aligned, end_list, end_aligned, &start, &end); -gfs2_metapath_ra (ip->i_gl, start, end); +gfs2_metapath_ra (gfs2_inode_glock (ip), start, end); } }
@@ -1986,7 +1986,7 @@ static int punch_hole(struct gfs2_inode *ip, u64 offset, u64 length)gfs2_quota_change (ip, -(s64 )btotal, ip->i_inode.i_uid, ip->i_inode.i_gid);inode_set_mtime_to_ts (&ip->i_inode,inode_set_ctime_current (&ip->i_inode)); -gfs2_trans_add_meta (ip->i_gl, dibh); +gfs2_trans_add_meta (gfs2_inode_glock (ip), dibh);gfs2_dinode_out (ip, dibh->b_data);up_write (&ip->i_rw_mutex);gfs2_trans_end (sdp);
@@ -2031,7 +2031,7 @@ static int trunc_end(struct gfs2_inode *ip)inode_set_mtime_to_ts (&ip->i_inode,inode_set_ctime_current (&ip->i_inode)); ip->i_diskflags &= ~GFS2_DIF_TRUNC_IN_PROG ; -gfs2_trans_add_meta (ip->i_gl, dibh); +gfs2_trans_add_meta (gfs2_inode_glock (ip), dibh);gfs2_dinode_out (ip, dibh->b_data);brelse (dibh);
@@ -2136,7 +2136,7 @@ static int do_grow(struct inode *inode, u64 size)truncate_setsize (inode, size);inode_set_mtime_to_ts (&ip->i_inode,inode_set_ctime_current (&ip->i_inode)); -gfs2_trans_add_meta (ip->i_gl, dibh); +gfs2_trans_add_meta (gfs2_inode_glock (ip), dibh);gfs2_dinode_out (ip, dibh->b_data);brelse (dibh);
@@ -2387,7 +2387,7 @@ static int stuffed_zero_range(struct inode *inode, loff_t offset, loff_t length) error =gfs2_meta_inode_buffer (ip, &dibh);if (error)return error; -gfs2_trans_add_meta (ip->i_gl, dibh); +gfs2_trans_add_meta (gfs2_inode_glock (ip), dibh);memset (dibh->b_data +sizeof (struct gfs2_dinode ) + offset,0 , length);brelse (dibh);
fs/gfs2/dentry.c +2 -2
@@ -57,9 +57,9 @@ static int gfs2_drevalidate(struct inode *dir, const struct qstr *name,if (sdp->sd_lockstruct.ls_ops->lm_mount ==NULL )return 1 ; - had_lock = (gfs2_glock_is_locked_by_me (dip->i_gl) !=NULL ); + had_lock = (gfs2_glock_is_locked_by_me (gfs2_inode_glock (dip)) !=NULL );if (!had_lock) { - error =gfs2_glock_nq_init (dip->i_gl,LM_ST_SHARED ,0 , &d_gh); + error =gfs2_glock_nq_init (gfs2_inode_glock (dip),LM_ST_SHARED ,0 , &d_gh);if (error)return 0 ; }
fs/gfs2/dir.c +21 -21
155 lines not on this page · raw message
fs/gfs2/export.c +1 -1
@@ -109,7 +109,7 @@ static int gfs2_get_name(struct dentry *parent, char *name, gnfd.inum.no_addr = ip->i_no_addr; gnfd.inum.no_formal_ino = ip->i_no_formal_ino; - error =gfs2_glock_nq_init (dip->i_gl,LM_ST_SHARED ,0 , &gh); + error =gfs2_glock_nq_init (gfs2_inode_glock (dip),LM_ST_SHARED ,0 , &gh);if (error)return error;
fs/gfs2/file.c +20 -20
@@ -63,7 +63,7 @@ static loff_t gfs2_llseek(struct file *file, loff_t offset, int whence)switch (whence) {case SEEK_END : - error =gfs2_glock_nq_init (ip->i_gl,LM_ST_SHARED ,LM_FLAG_ANY , + error =gfs2_glock_nq_init (gfs2_inode_glock (ip),LM_ST_SHARED ,LM_FLAG_ANY , &i_gh);if (!error) { error =generic_file_llseek (file, offset, whence);
@@ -109,7 +109,7 @@ static int gfs2_readdir(struct file *file, struct dir_context *ctx)struct gfs2_holder d_gh;int error; - error =gfs2_glock_nq_init (dip->i_gl,LM_ST_SHARED ,0 , &d_gh); + error =gfs2_glock_nq_init (gfs2_inode_glock (dip),LM_ST_SHARED ,0 , &d_gh);if (error)return error;
@@ -166,7 +166,7 @@ int gfs2_fileattr_get(struct dentry *dentry, struct file_kattr *fa)if (d_is_special (dentry))return -ENOTTY ; -gfs2_holder_init (ip->i_gl,LM_ST_SHARED ,0 , &gh); +gfs2_holder_init (gfs2_inode_glock (ip),LM_ST_SHARED ,0 , &gh); error =gfs2_glock_nq (&gh);if (error) goto out_uninit;
@@ -225,7 +225,7 @@ static int do_gfs2_set_flags(struct inode *inode, u32 reqflags, u32 mask)int error;u32 new_flags, flags; - error =gfs2_glock_nq_init (ip->i_gl,LM_ST_EXCLUSIVE ,0 , &gh); + error =gfs2_glock_nq_init (gfs2_inode_glock (ip),LM_ST_EXCLUSIVE ,0 , &gh);if (error)return error;
@@ -242,7 +242,7 @@ static int do_gfs2_set_flags(struct inode *inode, u32 reqflags, u32 mask) }if ((flags ^ new_flags) &GFS2_DIF_JDATA ) {if (new_flags &GFS2_DIF_JDATA ) -gfs2_log_flush (sdp, ip->i_gl, +gfs2_log_flush (sdp,gfs2_inode_glock (ip),GFS2_LOG_HEAD_FLUSH_NORMAL |GFS2_LFC_SET_FLAGS ); error =filemap_fdatawrite (inode->i_mapping);
@@ -262,7 +262,7 @@ static int do_gfs2_set_flags(struct inode *inode, u32 reqflags, u32 mask)if (error) goto out_trans_end;inode_set_ctime_current (inode); -gfs2_trans_add_meta (ip->i_gl, bh); +gfs2_trans_add_meta (gfs2_inode_glock (ip), bh); ip->i_diskflags = new_flags;gfs2_dinode_out (ip, bh->b_data);brelse (bh);
@@ -430,7 +430,7 @@ static vm_fault_t gfs2_page_mkwrite(struct vm_fault *vmf)sb_start_pagefault (inode->i_sb); -gfs2_holder_init (ip->i_gl,LM_ST_EXCLUSIVE ,0 , &gh); +gfs2_holder_init (gfs2_inode_glock (ip),LM_ST_EXCLUSIVE ,0 , &gh); err =gfs2_glock_nq (&gh);if (err) { ret =vmf_fs_error (err);
@@ -455,7 +455,7 @@ static vm_fault_t gfs2_page_mkwrite(struct vm_fault *vmf)gfs2_size_hint (vmf->vma->vm_file, pos, length); -set_bit (GLF_DIRTY , &ip->i_gl->gl_flags); +set_bit (GLF_DIRTY , &gfs2_inode_glock (ip)->gl_flags);set_bit (GIF_SW_PAGED , &ip->i_flags);/*
@@ -557,7 +557,7 @@ static vm_fault_t gfs2_fault(struct vm_fault *vmf)vm_fault_t ret;int err; -gfs2_holder_init (ip->i_gl,LM_ST_SHARED ,0 , &gh); +gfs2_holder_init (gfs2_inode_glock (ip),LM_ST_SHARED ,0 , &gh); err =gfs2_glock_nq (&gh);if (err) { ret =vmf_fs_error (err);
@@ -597,7 +597,7 @@ static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)struct gfs2_holder i_gh;int error; - error =gfs2_glock_nq_init (ip->i_gl,LM_ST_SHARED ,LM_FLAG_ANY , + error =gfs2_glock_nq_init (gfs2_inode_glock (ip),LM_ST_SHARED ,LM_FLAG_ANY , &i_gh);if (error)return error;
@@ -680,7 +680,7 @@ static int gfs2_open(struct inode *inode, struct file *file)bool need_unlock = false;if (S_ISREG (ip->i_inode.i_mode)) { - error =gfs2_glock_nq_init (ip->i_gl,LM_ST_SHARED ,LM_FLAG_ANY , + error =gfs2_glock_nq_init (gfs2_inode_glock (ip),LM_ST_SHARED ,LM_FLAG_ANY , &i_gh);if (error)return error;
@@ -767,7 +767,7 @@ static int gfs2_fsync(struct file *file, loff_t start, loff_t end, ret =file_write_and_wait (file);if (ret)return ret; -gfs2_ail_flush (ip->i_gl,1 ); +gfs2_ail_flush (gfs2_inode_glock (ip),1 ); }if (mapping->nrpages)
@@ -837,7 +837,7 @@ static ssize_t gfs2_file_direct_read(struct kiocb *iocb, struct iov_iter *to,if (!iov_iter_count (to))return 0 ;/* skip atime */ -gfs2_holder_init (ip->i_gl,LM_ST_DEFERRED ,0 , gh); +gfs2_holder_init (gfs2_inode_glock (ip),LM_ST_DEFERRED ,0 , gh); retry: ret =gfs2_glock_nq (gh);if (ret)
@@ -900,7 +900,7 @@ static ssize_t gfs2_file_direct_write(struct kiocb *iocb, struct iov_iter *from,* unfortunately, have the option of only flushing a range like the * VFS does. */ -gfs2_holder_init (ip->i_gl,LM_ST_DEFERRED ,0 , gh); +gfs2_holder_init (gfs2_inode_glock (ip),LM_ST_DEFERRED ,0 , gh); retry: ret =gfs2_glock_nq (gh);if (ret)
@@ -980,7 +980,7 @@ static ssize_t gfs2_file_read_iter(struct kiocb *iocb, struct iov_iter *to)return ret; } ip =GFS2_I (iocb->ki_filp->f_mapping->host); -gfs2_holder_init (ip->i_gl,LM_ST_SHARED ,0 , &gh); +gfs2_holder_init (gfs2_inode_glock (ip),LM_ST_SHARED ,0 , &gh); retry: ret =gfs2_glock_nq (&gh);if (ret)
@@ -1034,7 +1034,7 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb,return -ENOMEM ; } -gfs2_holder_init (ip->i_gl,LM_ST_EXCLUSIVE ,0 , gh); +gfs2_holder_init (gfs2_inode_glock (ip),LM_ST_EXCLUSIVE ,0 , gh);if (should_fault_in_pages (from, iocb, &prev_count, &window_size)) { retry: window_size -=fault_in_iov_iter_readable (from, window_size);
@@ -1051,7 +1051,7 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb,if (inode == sdp->sd_rindex) {struct gfs2_inode *m_ip =GFS2_I (sdp->sd_statfs_inode); - ret =gfs2_glock_nq_init (m_ip->i_gl,LM_ST_EXCLUSIVE , + ret =gfs2_glock_nq_init (gfs2_inode_glock (m_ip),LM_ST_EXCLUSIVE ,GL_NOCACHE , statfs_gh);if (ret) goto out_unlock;
@@ -1112,7 +1112,7 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)gfs2_size_hint (file, iocb->ki_pos,iov_iter_count (from));if (iocb->ki_flags &IOCB_APPEND ) { - ret =gfs2_glock_nq_init (ip->i_gl,LM_ST_SHARED ,0 , &gh); + ret =gfs2_glock_nq_init (gfs2_inode_glock (ip),LM_ST_SHARED ,0 , &gh);if (ret)return ret;gfs2_glock_dq_uninit (&gh);
@@ -1189,7 +1189,7 @@ static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len)if (unlikely (error))return error; -gfs2_trans_add_meta (ip->i_gl, dibh); +gfs2_trans_add_meta (gfs2_inode_glock (ip), dibh);if (gfs2_is_stuffed (ip)) { error =gfs2_unstuff_dinode (ip);
@@ -1390,7 +1390,7 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t leinode_lock (inode); -gfs2_holder_init (ip->i_gl,LM_ST_EXCLUSIVE ,0 , &gh); +gfs2_holder_init (gfs2_inode_glock (ip),LM_ST_EXCLUSIVE ,0 , &gh); ret =gfs2_glock_nq (&gh);if (ret) goto out_uninit;
fs/gfs2/glock.c +1 -1
@@ -918,7 +918,7 @@ static void gfs2_try_to_evict(struct gfs2_glock *gl)/* If the inode was evicted, gl->gl_object will now be NULL. */ ip =gfs2_grab_existing_inode (gl);if (ip) { -gfs2_glock_poke (ip->i_gl); +gfs2_glock_poke (gfs2_inode_glock (ip));iput (&ip->i_inode); } }
fs/gfs2/glops.c +1 -1
@@ -603,7 +603,7 @@ static int freeze_go_xmote_bh(struct gfs2_glock *gl) {struct gfs2_sbd *sdp =glock_sbd (gl);struct gfs2_inode *ip =GFS2_I (sdp->sd_jdesc->jd_inode); -struct gfs2_glock *j_gl = ip->i_gl; +struct gfs2_glock *j_gl =gfs2_inode_glock (ip);struct gfs2_log_header_host head;int error;
fs/gfs2/incore.h +10 -2
@@ -392,7 +392,7 @@ struct gfs2_inode {u64 i_generation;u64 i_eattr;unsigned long i_flags;/* GIF_... */ -struct gfs2_glock *i_gl; +struct gfs2_glock __rcu *i_gl;struct gfs2_holder i_iopen_gh;struct gfs2_qadata *i_qadata;/* quota allocation data */ struct gfs2_holder i_rgd_gh;
@@ -878,5 +878,13 @@ static inline unsigned gfs2_max_stuffed_size(const struct gfs2_inode *ip) return GFS2_SB(&ip->i_inode)->sd_sb.sb_bsize - sizeof(struct gfs2_dinode); } -#endif /* __INCORE_DOT_H__ */ +static inline struct gfs2_glock *gfs2_inode_glock (const struct gfs2_inode *ip) +{ +/* +* i_gl is set once at instantiation and only NULLed at evict, +* so it is stable for any live inode. +*/ +return rcu_dereference_protected (ip->i_gl,1 ); +} +#endif /* __INCORE_DOT_H__ */
fs/gfs2/inode.c +50 -48
292 lines not on this page · raw message
fs/gfs2/lops.c +6 -6
@@ -777,7 +777,7 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, u32 start, {struct gfs2_inode *ip =GFS2_I (jd->jd_inode);struct gfs2_sbd *sdp =GFS2_SB (jd->jd_inode); -struct gfs2_glock *gl = ip->i_gl; +struct gfs2_glock *gl =gfs2_inode_glock (ip);unsigned int blks =be32_to_cpu (ld->ld_data1);struct buffer_head *bh_log, *bh_ip;u64 blkno;
@@ -832,13 +832,13 @@ static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)struct gfs2_sbd *sdp =GFS2_SB (jd->jd_inode);if (error) { -gfs2_inode_metasync (ip->i_gl); +gfs2_inode_metasync (gfs2_inode_glock (ip));return ; }if (pass !=1 )return ; -gfs2_inode_metasync (ip->i_gl); +gfs2_inode_metasync (gfs2_inode_glock (ip));fs_info (sdp,"jid=%u: Replayed %u of %u blocks\n" , jd->jd_jid, jd->jd_replayed_blocks, jd->jd_found_blocks);
@@ -1001,7 +1001,7 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, u32 start, __be64 *ptr, int pass) {struct gfs2_inode *ip =GFS2_I (jd->jd_inode); -struct gfs2_glock *gl = ip->i_gl; +struct gfs2_glock *gl =gfs2_inode_glock (ip);unsigned int blks =be32_to_cpu (ld->ld_data1);struct buffer_head *bh_log, *bh_ip;u64 blkno;
@@ -1052,14 +1052,14 @@ static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)struct gfs2_sbd *sdp =GFS2_SB (jd->jd_inode);if (error) { -gfs2_inode_metasync (ip->i_gl); +gfs2_inode_metasync (gfs2_inode_glock (ip));return ; }if (pass !=1 )return ;/* data sync? */ -gfs2_inode_metasync (ip->i_gl); +gfs2_inode_metasync (gfs2_inode_glock (ip));fs_info (sdp,"jid=%u: Replayed %u of %u data blocks\n" , jd->jd_jid, jd->jd_replayed_blocks, jd->jd_found_blocks);
fs/gfs2/meta_io.c +3 -3
@@ -407,13 +407,13 @@ void gfs2_journal_wipe(struct gfs2_inode *ip, u64 bstart, u32 blen)int ty;/* This can only happen during incomplete inode creation. */ -if (!ip->i_gl) +if (!gfs2_inode_glock (ip))return ;gfs2_ail1_wipe (sdp, bstart, blen);while (blen) { ty =REMOVE_META ; - bh =gfs2_getbuf (ip->i_gl, bstart,NO_CREATE ); + bh =gfs2_getbuf (gfs2_inode_glock (ip), bstart,NO_CREATE );if (!bh &&gfs2_is_jdata (ip)) { bh =gfs2_getjdatabuf (ip, bstart); ty =REMOVE_JDATA ;
@@ -448,7 +448,7 @@ int gfs2_meta_buffer(struct gfs2_inode *ip, u32 mtype, u64 num, struct buffer_head **bhp) {struct gfs2_sbd *sdp =GFS2_SB (&ip->i_inode); -struct gfs2_glock *gl = ip->i_gl; +struct gfs2_glock *gl =gfs2_inode_glock (ip);struct buffer_head *bh;int ret =0 ;int rahead =0 ;
fs/gfs2/ops_fstype.c +4 -4
@@ -543,7 +543,7 @@ static int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)mutex_lock (&sdp->sd_jindex_mutex);for (;;) { - error =gfs2_glock_nq_init (dip->i_gl,LM_ST_SHARED ,0 , ji_gh); + error =gfs2_glock_nq_init (gfs2_inode_glock (dip),LM_ST_SHARED ,0 , ji_gh);if (error)break ;
@@ -655,7 +655,7 @@ static int init_statfs(struct gfs2_sbd *sdp)iput (pn); pn =NULL ; ip =GFS2_I (sdp->sd_sc_inode); - error =gfs2_glock_nq_init (ip->i_gl,LM_ST_EXCLUSIVE ,GL_NOPID , + error =gfs2_glock_nq_init (gfs2_inode_glock (ip),LM_ST_EXCLUSIVE ,GL_NOPID , &sdp->sd_sc_gh);if (error) {fs_err (sdp,"can't lock local \"sc\" file: %d\n" , error);
@@ -750,7 +750,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo) } ip =GFS2_I (sdp->sd_jdesc->jd_inode); - error =gfs2_glock_nq_init (ip->i_gl,LM_ST_SHARED , + error =gfs2_glock_nq_init (gfs2_inode_glock (ip),LM_ST_SHARED ,LM_FLAG_RECOVER |GL_EXACT |GL_NOCACHE |GL_NOPID , &sdp->sd_jinode_gh);
@@ -919,7 +919,7 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo) pn =NULL ; ip =GFS2_I (sdp->sd_qc_inode); - error =gfs2_glock_nq_init (ip->i_gl,LM_ST_EXCLUSIVE ,GL_NOPID , + error =gfs2_glock_nq_init (gfs2_inode_glock (ip),LM_ST_EXCLUSIVE ,GL_NOPID , &sdp->sd_qc_gh);if (error) {fs_err (sdp,"can't lock local \"qc\" file: %d\n" , error);
fs/gfs2/quota.c +8 -8
@@ -434,7 +434,7 @@ static int bh_get(struct gfs2_quota_data *qd)if (iomap.type !=IOMAP_MAPPED )return error; - error =gfs2_meta_read (ip->i_gl, iomap.addr >> inode->i_blkbits, + error =gfs2_meta_read (gfs2_inode_glock (ip), iomap.addr >> inode->i_blkbits,DIO_WAIT ,0 , &bh);if (error)return error;
@@ -692,7 +692,7 @@ static void do_qc(struct gfs2_quota_data *qd, s64 change)bool needs_put = false;s64 x; -gfs2_trans_add_meta (ip->i_gl, qd->qd_bh); +gfs2_trans_add_meta (gfs2_inode_glock (ip), qd->qd_bh);/* * The QDF_CHANGE flag indicates that the slot in the quota change file
@@ -780,7 +780,7 @@ static int gfs2_write_buf_to_page(struct gfs2_sbd *sdp, unsigned long index,set_buffer_uptodate (bh);if (bh_read (bh,REQ_META |REQ_PRIO ) <0 ) goto unlock_out; -gfs2_trans_add_data (ip->i_gl, bh); +gfs2_trans_add_data (gfs2_inode_glock (ip), bh);/* If we need to write to the next block as well */ if (to_write > (bsize - boff)) {
@@ -935,7 +935,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda, goto out_dq; } - error =gfs2_glock_nq_init (ip->i_gl,LM_ST_EXCLUSIVE ,0 , &i_gh); + error =gfs2_glock_nq_init (gfs2_inode_glock (ip),LM_ST_EXCLUSIVE ,0 , &i_gh);if (error) goto out_dq;
@@ -993,7 +993,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda,gfs2_glock_dq_uninit (&ghs[qx]);inode_unlock (&ip->i_inode);kfree (ghs); -gfs2_log_flush (glock_sbd (ip->i_gl), ip->i_gl, +gfs2_log_flush (glock_sbd (gfs2_inode_glock (ip)),gfs2_inode_glock (ip),GFS2_LOG_HEAD_FLUSH_NORMAL |GFS2_LFC_DO_SYNC );if (!error) {for (x =0 ; x < num_qd; x++) {
@@ -1062,7 +1062,7 @@ static int do_glock(struct gfs2_quota_data *qd, int force_refresh,if (error)return error; - error =gfs2_glock_nq_init (ip->i_gl,LM_ST_SHARED ,0 , &i_gh); + error =gfs2_glock_nq_init (gfs2_inode_glock (ip),LM_ST_SHARED ,0 , &i_gh);if (error) goto fail;
@@ -1439,7 +1439,7 @@ int gfs2_quota_init(struct gfs2_sbd *sdp) goto fail; } error = -EIO ; - bh =gfs2_meta_ra (ip->i_gl, dblock, extlen); + bh =gfs2_meta_ra (gfs2_inode_glock (ip), dblock, extlen);if (!bh) goto fail;if (gfs2_metatype_check (sdp, bh,GFS2_METATYPE_QC ))
@@ -1745,7 +1745,7 @@ static int gfs2_set_dqblk(struct super_block *sb, struct kqid qid, error =gfs2_glock_nq_init (qd->qd_gl,LM_ST_EXCLUSIVE ,0 , &q_gh);if (error) goto out_unlockput; - error =gfs2_glock_nq_init (ip->i_gl,LM_ST_EXCLUSIVE ,0 , &i_gh); + error =gfs2_glock_nq_init (gfs2_inode_glock (ip),LM_ST_EXCLUSIVE ,0 , &i_gh);if (error) goto out_q;
fs/gfs2/recovery.c +3 -3
@@ -33,7 +33,7 @@ int gfs2_replay_read_block(struct gfs2_jdesc *jd, unsigned int blk, struct buffer_head **bh) {struct gfs2_inode *ip =GFS2_I (jd->jd_inode); -struct gfs2_glock *gl = ip->i_gl; +struct gfs2_glock *gl =gfs2_inode_glock (ip);u64 dblock;u32 extlen;int error;
@@ -345,7 +345,7 @@ static int update_statfs_inode(struct gfs2_jdesc *jd,mark_buffer_dirty (bh);brelse (bh); -gfs2_inode_metasync (ip->i_gl); +gfs2_inode_metasync (gfs2_inode_glock (ip)); out:return error;
@@ -440,7 +440,7 @@ void gfs2_recover_func(struct work_struct *work) goto fail; } - error =gfs2_glock_nq_init (ip->i_gl,LM_ST_SHARED , + error =gfs2_glock_nq_init (gfs2_inode_glock (ip),LM_ST_SHARED ,LM_FLAG_RECOVER |GL_NOCACHE , &ji_gh);if (error)
fs/gfs2/rgrp.c +2 -2
@@ -1034,7 +1034,7 @@ static int gfs2_ri_update(struct gfs2_inode *ip)int gfs2_rindex_update (struct gfs2_sbd *sdp) {struct gfs2_inode *ip =GFS2_I (sdp->sd_rindex); -struct gfs2_glock *gl = ip->i_gl; +struct gfs2_glock *gl =gfs2_inode_glock (ip);struct gfs2_holder ri_gh;int error =0 ;int unlock_required =0 ;
@@ -2453,7 +2453,7 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks,if (error ==0 ) {struct gfs2_dinode *di = (struct gfs2_dinode *)dibh->b_data; -gfs2_trans_add_meta (ip->i_gl, dibh); +gfs2_trans_add_meta (gfs2_inode_glock (ip), dibh); di->di_goal_meta = di->di_goal_data =cpu_to_be64 (ip->i_goal);brelse (dibh);
fs/gfs2/super.c +26 -26
169 lines not on this page · raw message
fs/gfs2/trace_gfs2.h +3 -3
@@ -458,7 +458,7 @@ TRACE_EVENT(gfs2_bmap, ),TP_fast_assign ( - __entry->dev = glock_sbd(ip->i_gl)->sd_vfs->s_dev; + __entry->dev = glock_sbd(gfs2_inode_glock(ip))->sd_vfs->s_dev; __entry->lblock = lblock; __entry->pblock =buffer_mapped (bh) ? bh->b_blocknr :0 ; __entry->inum = ip->i_no_addr;
@@ -494,7 +494,7 @@ TRACE_EVENT(gfs2_iomap_start, ),TP_fast_assign ( - __entry->dev = glock_sbd(ip->i_gl)->sd_vfs->s_dev; + __entry->dev = glock_sbd(gfs2_inode_glock(ip))->sd_vfs->s_dev; __entry->inum = ip->i_no_addr; __entry->pos = pos; __entry->length = length;
@@ -526,7 +526,7 @@ TRACE_EVENT(gfs2_iomap_end, ),TP_fast_assign ( - __entry->dev = glock_sbd(ip->i_gl)->sd_vfs->s_dev; + __entry->dev = glock_sbd(gfs2_inode_glock(ip))->sd_vfs->s_dev; __entry->inum = ip->i_no_addr; __entry->offset = iomap->offset; __entry->length = iomap->length;
fs/gfs2/util.c +2 -2
@@ -58,7 +58,7 @@ int check_journal_clean(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,struct gfs2_inode *ip; ip =GFS2_I (jd->jd_inode); - error =gfs2_glock_nq_init (ip->i_gl,LM_ST_SHARED ,LM_FLAG_RECOVER | + error =gfs2_glock_nq_init (gfs2_inode_glock (ip),LM_ST_SHARED ,LM_FLAG_RECOVER |GL_EXACT |GL_NOCACHE , &j_gh);if (error) {if (verbose)
@@ -342,7 +342,7 @@ void gfs2_consist_inode_i(struct gfs2_inode *ip, (unsigned long long )ip->i_no_formal_ino, (unsigned long long )ip->i_no_addr, function, file, line); -gfs2_dump_glock (NULL , ip->i_gl,1 ); +gfs2_dump_glock (NULL ,gfs2_inode_glock (ip),1 );gfs2_withdraw (sdp); }
fs/gfs2/xattr.c +27 -27
183 lines not on this page · raw message
Dan Carpenter
build botBCC: [email protected] CC: [email protected] In-Reply-To: <[email protected]> References: <[email protected]> TO: Adrian Garcia Casado…
BCC: [email protected]
CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Adrian Garcia Casado <[email protected]>
TO: Andreas Gruenbacher <[email protected]>
CC: [email protected]
CC: [email protected]
Hi Adrian,
kernel test robot noticed the following build warnings:
[auto build test WARNING on gfs2/for-next]
[also build test WARNING on linus/master v7.2 next-20260821] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Adrian-Garcia-Casado/gfs2-annotate-i_gl-with-__rcu-and-convert-to-accessor-helpers/20260806-113610 base: https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git for-next patch link: https://lore.kernel.org/r/6a74d41a.f3f7def5.e164f.560e%40mx.google.com patch subject: [PATCH v2] gfs2: annotate i_gl with __rcu and convert to accessor helpers
:::::: branch date: 32 hours ago
:::::: commit date: 32 hours ago
config: x86_64-randconfig-161 (https://download.01.org/0day-ci/archive/20260824/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
New smatch warnings:fs/gfs2/inode.c:150 gfs2_inode_lookup() warn: inconsistent indenting
Old smatch warnings:fs/gfs2/inode.c:364 gfs2_lookupi() warn: passing zero to 'ERR_PTR'
vim +150 fs/gfs2/inode.c
2c5f4a53476e3c fs/gfs2/inode.c Andreas Gruenbacher 2025-11-13 104
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 105 /**
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 106 * gfs2_inode_lookup - Lookup an inode
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 107 * @sb: The super block
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 108 * @type: The type of the inode
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 109 * @no_addr: The inode number
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 110 * @no_formal_ino: The inode generation number
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 111 * @blktype: Requested block type (GFS2_BLKST_DINODE or GFS2_BLKST_UNLINKED;
61b91cfdc6c0c4 fs/gfs2/inode.c Andreas Gruenbacher 2017-08-01 112 * GFS2_BLKST_FREE to indicate not to verify)
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 113 *
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 114 * If @type is DT_UNKNOWN, the inode type is fetched from disk.
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 115 *
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 116 * If @blktype is anything other than GFS2_BLKST_FREE (which is used as a
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 117 * placeholder because it doesn't otherwise make sense), the on-disk block type
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 118 * is verified to be @blktype.
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 119 *
b66648ad6dcfef fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 120 * When @no_formal_ino is non-zero, this function will return ERR_PTR(-ESTALE)
b66648ad6dcfef fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 121 * if it detects that @no_formal_ino doesn't match the actual inode generation
b66648ad6dcfef fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 122 * number. However, it doesn't always know unless @type is DT_UNKNOWN.
b66648ad6dcfef fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 123 *
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 124 * Returns: A VFS inode, or an error
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 125 */
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 126
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 127 struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type,
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 128 u64 no_addr, u64 no_formal_ino,
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 129 unsigned int blktype)
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 130 {
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 131 struct inode *inode;
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 132 struct gfs2_inode *ip;
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 133 struct gfs2_holder i_gh;
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 134 int error;
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 135
6df9f9a253c7dc fs/gfs2/inode.c Andreas Gruenbacher 2016-06-17 136 gfs2_holder_mark_uninitialized(&i_gh);
5f6e13baebf31d fs/gfs2/inode.c Andreas Gruenbacher 2021-11-29 137 inode = iget5_locked(sb, no_addr, iget_test, iget_set, &no_addr);
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 138 if (!inode)
ac3beb6a5de048 fs/gfs2/inode.c Steven Whitehouse 2014-01-16 139 return ERR_PTR(-ENOMEM);
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 140
e97321fa095f1e fs/gfs2/inode.c Bob Peterson 2016-04-12 141 ip = GFS2_I(inode);
e97321fa095f1e fs/gfs2/inode.c Bob Peterson 2016-04-12 142
40a4c512ad2564 fs/gfs2/inode.c Mateusz Guzik 2025-10-09 143 if (inode_state_read_once(inode) & I_NEW) {
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 144 struct gfs2_sbd *sdp = GFS2_SB(inode);
5f6e13baebf31d fs/gfs2/inode.c Andreas Gruenbacher 2021-11-29 145 struct gfs2_glock *io_gl;
c412a97cf6c525 fs/gfs2/inode.c Bob Peterson 2022-08-22 146 int extra_flags = 0;
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 147
2c5f4a53476e3c fs/gfs2/inode.c Andreas Gruenbacher 2025-11-13 148 gfs2_setup_inode(inode);
f7e98cd66761db fs/gfs2/inode.c Adrian Garcia Casado 2026-08-06 149 { struct gfs2_glock *gl;
f7e98cd66761db fs/gfs2/inode.c Adrian Garcia Casado 2026-08-06 @150 error = gfs2_glock_get(sdp, no_addr, &gfs2_inode_glops, CREATE, &gl);
f7e98cd66761db fs/gfs2/inode.c Adrian Garcia Casado 2026-08-06 151 if (!error)
f7e98cd66761db fs/gfs2/inode.c Adrian Garcia Casado 2026-08-06 152 rcu_assign_pointer(ip->i_gl, gl); }
29464ee36bcaae fs/gfs2/inode.c Andreas Gruenbacher 2022-01-24 153 if (unlikely(error))
29464ee36bcaae fs/gfs2/inode.c Andreas Gruenbacher 2022-01-24 154 goto fail;
29464ee36bcaae fs/gfs2/inode.c Andreas Gruenbacher 2022-01-24 155
29464ee36bcaae fs/gfs2/inode.c Andreas Gruenbacher 2022-01-24 156 error = gfs2_glock_get(sdp, no_addr, &gfs2_iopen_glops, CREATE,
29464ee36bcaae fs/gfs2/inode.c Andreas Gruenbacher 2022-01-24 157 &io_gl);
29464ee36bcaae fs/gfs2/inode.c Andreas Gruenbacher 2022-01-24 158 if (unlikely(error))
29464ee36bcaae fs/gfs2/inode.c Andreas Gruenbacher 2022-01-24 159 goto fail;
29464ee36bcaae fs/gfs2/inode.c Andreas Gruenbacher 2022-01-24 160
2ec750a01d189c fs/gfs2/inode.c Andreas Gruenbacher 2022-12-04 161 /*
2ec750a01d189c fs/gfs2/inode.c Andreas Gruenbacher 2022-12-04 162 * The only caller that sets @blktype to GFS2_BLKST_UNLINKED is
2ec750a01d189c fs/gfs2/inode.c Andreas Gruenbacher 2022-12-04 163 * delete_work_func(). Make sure not to cancel the delete work
2ec750a01d189c fs/gfs2/inode.c Andreas Gruenbacher 2022-12-04 164 * from within itself here.
2ec750a01d189c fs/gfs2/inode.c Andreas Gruenbacher 2022-12-04 165 */
c412a97cf6c525 fs/gfs2/inode.c Bob Peterson 2022-08-22 166 if (blktype == GFS2_BLKST_UNLINKED)
c412a97cf6c525 fs/gfs2/inode.c Bob Peterson 2022-08-22 167 extra_flags |= LM_FLAG_TRY;
c412a97cf6c525 fs/gfs2/inode.c Bob Peterson 2022-08-22 168 else
29464ee36bcaae fs/gfs2/inode.c Andreas Gruenbacher 2022-01-24 169 gfs2_cancel_delete_work(io_gl);
c412a97cf6c525 fs/gfs2/inode.c Bob Peterson 2022-08-22 170 error = gfs2_glock_nq_init(io_gl, LM_ST_SHARED,
c7d7d2d345697e fs/gfs2/inode.c Andreas Gruenbacher 2022-10-09 171 GL_EXACT | GL_NOPID | extra_flags,
29464ee36bcaae fs/gfs2/inode.c Andreas Gruenbacher 2022-01-24 172 &ip->i_iopen_gh);
29464ee36bcaae fs/gfs2/inode.c Andreas Gruenbacher 2022-01-24 173 gfs2_glock_put(io_gl);
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 174 if (unlikely(error))
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 175 goto fail;
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 176
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 177 if (type == DT_UNKNOWN || blktype != GFS2_BLKST_FREE) {
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 178 /*
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 179 * The GL_SKIP flag indicates to skip reading the inode
5f6e13baebf31d fs/gfs2/inode.c Andreas Gruenbacher 2021-11-29 180 * block. We read the inode when instantiating it
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 181 * after possibly checking the block type.
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 182 */
f7e98cd66761db fs/gfs2/inode.c Adrian Garcia Casado 2026-08-06 183 error = gfs2_glock_nq_init(gfs2_inode_glock(ip), LM_ST_EXCLUSIVE,
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 184 GL_SKIP, &i_gh);
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 185 if (error)
40e7e86ef16550 fs/gfs2/inode.c Andreas Gruenbacher 2020-01-24 186 goto fail;
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 187
b66648ad6dcfef fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 188 error = -ESTALE;
b66648ad6dcfef fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 189 if (no_formal_ino &&
f7e98cd66761db fs/gfs2/inode.c Adrian Garcia Casado 2026-08-06 190 gfs2_inode_already_deleted(gfs2_inode_glock(ip), no_formal_ino))
b66648ad6dcfef fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 191 goto fail;
b66648ad6dcfef fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 192
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 193 if (blktype != GFS2_BLKST_FREE) {
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 194 error = gfs2_check_blk_type(sdp, no_addr,
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 195 blktype);
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 196 if (error)
40e7e86ef16550 fs/gfs2/inode.c Andreas Gruenbacher 2020-01-24 197 goto fail;
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 198 }
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 199 }
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 200
f7e98cd66761db fs/gfs2/inode.c Adrian Garcia Casado 2026-08-06 201 set_bit(GLF_INSTANTIATE_NEEDED, &gfs2_inode_glock(ip)->gl_flags);
5f6e13baebf31d fs/gfs2/inode.c Andreas Gruenbacher 2021-11-29 202
2b0fb353c029de fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 203 /* Lowest possible timestamp; will be overwritten in gfs2_dinode_in. */
580f721b6f5ad5 fs/gfs2/inode.c Jeff Layton 2023-10-04 204 inode_set_atime(inode,
580f721b6f5ad5 fs/gfs2/inode.c Jeff Layton 2023-10-04 205 1LL << (8 * sizeof(inode_get_atime_sec(inode)) - 1),
580f721b6f5ad5 fs/gfs2/inode.c Jeff Layton 2023-10-04 206 0);
2b0fb353c029de fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 207
f7e98cd66761db fs/gfs2/inode.c Adrian Garcia Casado 2026-08-06 208 glock_set_object(gfs2_inode_glock(ip), ip);
5f6e13baebf31d fs/gfs2/inode.c Andreas Gruenbacher 2021-11-29 209
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 210 if (type == DT_UNKNOWN) {
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 211 /* Inode glock must be locked already */
f2e70d8f2fdff0 fs/gfs2/inode.c Bob Peterson 2021-10-06 212 error = gfs2_instantiate(&i_gh);
5f6e13baebf31d fs/gfs2/inode.c Andreas Gruenbacher 2021-11-29 213 if (error) {
f7e98cd66761db fs/gfs2/inode.c Adrian Garcia Casado 2026-08-06 214 glock_clear_object(gfs2_inode_glock(ip), ip);
40e7e86ef16550 fs/gfs2/inode.c Andreas Gruenbacher 2020-01-24 215 goto fail;
5f6e13baebf31d fs/gfs2/inode.c Andreas Gruenbacher 2021-11-29 216 }
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 217 } else {
2b0fb353c029de fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 218 ip->i_no_formal_ino = no_formal_ino;
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 219 inode->i_mode = DT2IF(type);
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 220 }
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 221
b66648ad6dcfef fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 222 if (gfs2_holder_initialized(&i_gh))
b66648ad6dcfef fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 223 gfs2_glock_dq_uninit(&i_gh);
5f6e13baebf31d fs/gfs2/inode.c Andreas Gruenbacher 2021-11-29 224 glock_set_object(ip->i_iopen_gh.gh_gl, ip);
b66648ad6dcfef fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 225
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 226 gfs2_set_iop(inode);
b8e12e3599ad61 fs/gfs2/inode.c Andreas Gruenbacher 2021-11-29 227 unlock_new_inode(inode);
b66648ad6dcfef fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 228 }
332f51d7db13ff fs/gfs2/inode.c Andreas Gruenbacher 2016-09-26 229
b66648ad6dcfef fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 230 if (no_formal_ino && ip->i_no_formal_ino &&
b66648ad6dcfef fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 231 no_formal_ino != ip->i_no_formal_ino) {
b66648ad6dcfef fs/gfs2/inode.c Andreas Gruenbacher 2020-01-15 232 iput(inode);
b8e12e3599ad61 fs/gfs2/inode.c Andreas Gruenbacher 2021-11-29 233 return ERR_PTR(-ESTALE);
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 234 }
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 235
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 236 return inode;
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 237
40e7e86ef16550 fs/gfs2/inode.c Andreas Gruenbacher 2020-01-24 238 fail:
c412a97cf6c525 fs/gfs2/inode.c Bob Peterson 2022-08-22 239 if (error == GLR_TRYFAILED)
c412a97cf6c525 fs/gfs2/inode.c Bob Peterson 2022-08-22 240 error = -EAGAIN;
5f6e13baebf31d fs/gfs2/inode.c Andreas Gruenbacher 2021-11-29 241 if (gfs2_holder_initialized(&ip->i_iopen_gh))
763766c0571ea1 fs/gfs2/inode.c Bob Peterson 2021-09-29 242 gfs2_glock_dq_uninit(&ip->i_iopen_gh);
6df9f9a253c7dc fs/gfs2/inode.c Andreas Gruenbacher 2016-06-17 243 if (gfs2_holder_initialized(&i_gh))
3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 244 gfs2_glock_dq_uninit(&i_gh);
f7e98cd66761db fs/gfs2/inode.c Adrian Garcia Casado 2026-08-06 245 if (gfs2_inode_glock(ip)) {
f7e98cd66761db fs/gfs2/inode.c Adrian Garcia Casado 2026-08-06 246 gfs2_glock_put(gfs2_inode_glock(ip));
f7e98cd66761db fs/gfs2/inode.c Adrian Garcia Casado 2026-08-06 247 rcu_assign_pointer(ip->i_gl, NULL);
9ffa18884cceb2 fs/gfs2/inode.c Andreas Gruenbacher 2023-01-23 248 }
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 249 iget_failed(inode);
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 250 return ERR_PTR(error);
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 251 }
194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 252 --
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Andreas Gruenbacher
maintainerDan,
Quoted 52 lines · Dan Carpenter
Hi Adrian,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Adrian-Garcia-Casado/gfs2-annotate-i_gl-with-__rcu-and-convert-to-accessor-helpers/20260806-113610 base: https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git for-next patch link: https://lore.kernel.org/r/6a74d41a.f3f7def5.e164f.560e%40mx.google.com patch subject: [PATCH v2] gfs2: annotate i_gl with __rcu and convert to accessor helpers config: x86_64-randconfig-161 (https://download.01.org/0day-ci/archive/20260824/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 smatch: v0.5.0-9187-g5189e3fbIf you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/New smatch warnings:
fs/gfs2/inode.c:150gfs2_inode_lookup()warn: inconsistent indentingvim +150
fs/gfs2/inode.c194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 127 struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type, 3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 128 u64 no_addr, u64 no_formal_ino, 3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 129 unsigned int blktype) 194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 130 { 194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 131 struct inode *inode; 194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 132 struct gfs2_inode *ip; 3ce37b2cb49176 fs/gfs2/inode.c Andreas Gruenbacher 2016-06-14 133 struct gfs2_holder i_gh; 194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 134 int error; 194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 135 6df9f9a253c7dc fs/gfs2/inode.c Andreas Gruenbacher 2016-06-17 136 gfs2_holder_mark_uninitialized(&i_gh); 5f6e13baebf31d fs/gfs2/inode.c Andreas Gruenbacher 2021-11-29 137 inode = iget5_locked(sb, no_addr, iget_test, iget_set, &no_addr); 194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 138 if (!inode) ac3beb6a5de048 fs/gfs2/inode.c Steven Whitehouse 2014-01-16 139 return ERR_PTR(-ENOMEM); 194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 140 e97321fa095f1e fs/gfs2/inode.c Bob Peterson 2016-04-12 141 ip = GFS2_I(inode); e97321fa095f1e fs/gfs2/inode.c Bob Peterson 2016-04-12 142 40a4c512ad2564 fs/gfs2/inode.c Mateusz Guzik 2025-10-09 143 if (inode_state_read_once(inode) & I_NEW) { 194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 144 struct gfs2_sbd *sdp = GFS2_SB(inode); 5f6e13baebf31d fs/gfs2/inode.c Andreas Gruenbacher 2021-11-29 145 struct gfs2_glock *io_gl; c412a97cf6c525 fs/gfs2/inode.c Bob Peterson 2022-08-22 146 int extra_flags = 0; 194c011fc4650d fs/gfs2/ops_inode.c Steven Whitehouse 2011-05-09 147 2c5f4a53476e3c fs/gfs2/inode.c Andreas Gruenbacher 2025-11-13 148 gfs2_setup_inode(inode); f7e98cd66761db fs/gfs2/inode.c Adrian Garcia Casado 2026-08-06 149 { struct gfs2_glock *gl; f7e98cd66761db fs/gfs2/inode.c Adrian Garcia Casado 2026-08-06 @150 error = gfs2_glock_get(sdp, no_addr, &gfs2_inode_glops, CREATE, &gl); f7e98cd66761db fs/gfs2/inode.c Adrian Garcia Casado 2026-08-06 151 if (!error) f7e98cd66761db fs/gfs2/inode.c Adrian Garcia Casado 2026-08-06 152 rcu_assign_pointer(ip->i_gl, gl); }
Quoted 2 lines
What's going with the indenting? This looks like debug code accidentlly escaped?
this patch can be ignored; it has been superseded by the following patch set:
https://lore.kernel.org/gfs2/[email protected]
Thanks,
Andreas
Quoted 10 lines
29464ee36bcaae fs/gfs2/inode.c Andreas Gruenbacher 2022-01-24 153 if (unlikely(error)) 29464ee36bcaae fs/gfs2/inode.c Andreas Gruenbacher 2022-01-24 154 goto fail; 29464ee36bcaae fs/gfs2/inode.c Andreas Gruenbacher 2022-01-24 155 29464ee36bcaae fs/gfs2/inode.c Andreas Gruenbacher 2022-01-24 156 error = gfs2_glock_get(sdp, no_addr, &gfs2_iopen_glops, CREATE, 29464ee36bcaae fs/gfs2/inode.c Andreas Gruenbacher 2022-01-24 157 &io_gl);--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki