2

I study with details the structure of the VFS superblock and I noticed the field

struct hlist_head s_pins;

Even though I made an extensive search it was not possible to find info about this. I only found that this is defined and used in fs_pins.c and in functions as pin_insert & etc cetera, but there is no information about its usage and its role. In fact, I found a PIN control subsystem, but I don't know if this is the same since it seems to be associated to hardware pins and not to file systems.

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250

1 Answers1

4

These pins are used by the accounting subsystem: they ensure that acct_pin_kill is called when file systems are unmounted or remounted, so that accounting can take appropriate action. (Accounting writes information to a file, so it needs to know when that file will no longer be writable.)

Pins were intended as a more general-purpose way for code to be attached to mounts, but that ended up never quite getting there.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
  • I study the struct mount and i noticed the field mnt_pins. I suppose that its purpose is the same as the s_pins described above. – Athanasios Margaris Feb 12 '21 at 09:05
  • Yes, `mnt_pins` is the counterpart of `s_pins` in `struct mount`; you can see it set alongside `s_pins` in [`pin_insert`](https://elixir.bootlin.com/linux/v5.10.9/source/fs/fs_pin.c#L22). – Stephen Kitt Feb 12 '21 at 09:44