kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Does "i_mutex" in comments mean inode_lock() in code ?
@ 2020-08-18  7:02 Thomas Schmitt
  0 siblings, 0 replies; only message in thread
From: Thomas Schmitt @ 2020-08-18  7:02 UTC (permalink / raw)
  To: kernelnewbies

Hi,

is function inode_lock() the thing which controls what lots of comments
call "i_mutex" ?

I am in particular riddling over this comment in include/linux/fs.h :

/*
 * NOTE: unlike i_size_read(), i_size_write() does need locking around it
 * (normally i_mutex), otherwise on 32bit/SMP an update of i_size_seqcount
 * can be lost, resulting in subsequent i_size_read() calls spinning forever.
 */

because i cannot find any example in the git tree by
  grep -r mutex_unlock'.*[^a-z]'i_mutex .
and the same for mutex_lock or mutex_trylock.

But i see lots of comments mentioning an "i_mutex" structure element by
  grep -r '.*->'i_mutex .

The nearest discovery to what i search for is in include/linux/fs.h
  static inline void inode_lock(struct inode *inode)
It has lots of call instances in the code.
But in contrast to "->imutex" i found not a glimpse of documentation.
(Well it has enough room to hide from me ...)

So is this the call by which i can reserve a cdrom device file inode
before i call i_size_write() ?

If so, shouldn't the comment in fs.h be "... (normally inode_lock) ..." ?


Have a nice day :)

Thomas


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-18  7:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18  7:02 Does "i_mutex" in comments mean inode_lock() in code ? Thomas Schmitt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).