Commit Graph
2307 Commits
Author SHA1 Message Date
Zach BrownandZach Brown 6f5cfd8cc2 scoutfs: use rid instead of node_id in items
Use the mount's generated random id in persistent items and the lock
that protects them instead of the assigned node_id.

Signed-off-by: Zach Brown <zab@versity.com>
2019-08-20 15:52:13 -07:00
Zach BrownandZach Brown bd7a7fe97e scoutfs: use fr identity in pseudo fs paths
Use the fr mount identity string in the sysfs/fs/ and debugfs paths we
register for each mount.

Signed-off-by: Zach Brown <zab@versity.com>
2019-08-20 15:52:13 -07:00
Zach BrownandZach Brown 7a36a289d2 scoutfs: add rid to trace messages
Add the mount rid to traces which included the fsid by converting them
to use the super block message format and args.

Signed-off-by: Zach Brown <zab@versity.com>
2019-08-20 15:52:13 -07:00
Zach BrownandZach Brown 754ce95f5c scoutfs: use rid in console messages
Change the console message output to show the fsid:rid mount identity
instead of the block device name and device major and minor numbers.

Signed-off-by: Zach Brown <zab@versity.com>
2019-08-20 15:52:13 -07:00
Zach BrownandZach Brown 7acbf4cc8b scoutfs: add super block format and args
Add macros which provide printk format and args for a little string
which identifies a specific mount.  This will be used in kernel logs and
trace messages.

Signed-off-by: Zach Brown <zab@versity.com>
2019-08-20 15:52:13 -07:00
Zach BrownandZach Brown b147d74967 scoutfs: add per-mount random id
Calculate a random id which identifies the life of a particular mount.
This will be visible in messages and tracing and will replace the
server-assigned node_id in persistent structures and protocols.

Signed-off-by: Zach Brown <zab@versity.com>
2019-08-20 15:52:13 -07:00
Zach Brown 2b966fd45c scoutfs-tests: use larger fr ident strings
The kernel is now using three bytes from the ids to form the fr ident
string for a mount.

Signed-off-by: Zach Brown <zab@versity.com>
2019-08-16 14:16:30 -07:00
Zach Brown 3981f944dd scoutfs-tests: more dmesg filters
Add some more filters for device-mapper output and keep up with the lock
recovery messages in the kernel.

Signed-off-by: Zach Brown <zab@versity.com>
2019-08-16 14:15:52 -07:00
Zach Brown b9bd7d1293 scoutfs-tests: initial commit
The first commit of the scoutfs-tests suite which uses multiple mounts
on one host to test multi-node scoutfs.

Signed-off-by: Zach Brown <zab@versity.com>
2019-08-02 16:51:34 -07:00
Zach BrownandZach Brown adadd51815 scoutfs-utils: update for listxattr_hidden
listxattr_raw was renamed to listxattr_hidden to more accurately
describe the only reason that it exists.

Signed-off-by: Zach Brown <zab@versity.com>
2019-06-28 10:23:59 -07:00
Zach BrownandZach Brown 9a087be46c scoutfs-utils: update ioctl _IO usage
Signed-off-by: Zach Brown <zab@versity.com>
2019-06-28 10:23:59 -07:00
Zach BrownandZach Brown d8bc962fc5 scoutfs: unpriv listxattr_hidden only shows .hide.
Our hidden attributes are hidden so that they don't leak out of
the system when archiving tools transfer xattrs from listxattr along
with the file.  They're not intended to be secret, in fact users want to
see their contents like they want to see other fs metadata that they
can't update which describes the system.

Make our listxattr ioctl only return hidden xattrs and allow anyone to
see the results if they can read the file.   Rename it to more
accurately describe its intended use.

Signed-off-by: Zach Brown <zab@versity.com>
2019-06-28 10:23:55 -07:00
Zach BrownandZach Brown 663ce53109 scoutfs: clean up _IO ioctl macro usage
Accurately set the direction bits, pack down the used numbers, and
remove stale old ioctl definitions.

Signed-off-by: Zach Brown <zab@versity.com>
2019-06-28 10:23:55 -07:00
Zach BrownandZach Brown 8597fd0bfc scoutfs-utils: naturally align ioctl structs
Use natuturally aligned and explicitly padded ioctl structs.

Signed-off-by: Zach Brown <zab@versity.com>
2019-06-27 11:39:19 -07:00
Zach BrownandZach Brown 4a29cb5888 scoutfs: naturally align ioctl structs
Order the ioctl struct field definitions and add padding so that
runtimes with different word dizes don't add different padding.
Userspace is spared having to deal with packing and we don't
have to worry about compat translation in the kernel.

We had two persistent structures that crossed the ioctl, a key and a
timespec, so we explicitly translate to and from their persistent types
in the ioctl.

Signed-off-by: Zach Brown <zab@versity.com>
2019-06-27 11:39:11 -07:00
Zach Brown 674224d454 scoutfs-utils: hidden and indexed xattrs
Add support for the xattr tags which can hide or index xattrs by their
name.  We get an item that indexes inodes by the presence of an xattr, a
listxattr_raw ioctl which can show hidden xattrs, and an ioctl that
finds inodes which have an xattr.

Signed-off-by: Zach Brown <zab@versity.com>
2019-06-24 10:08:35 -07:00
Zach BrownandZach Brown 7dfbd3950f scoutfs: add index of inodes by xattr names
Add a .indx. xattr tag which adds the inode to an index of inodes keyed
by the hash of xattr names.  An ioctl is added which then returns all
the inodes which may contain an xattr of the given name.  Dropping all
xattrs now has to parse the name to find out if it also has to delete an
index item.

Signed-off-by: Zach Brown <zab@versity.com>
2019-06-24 09:58:22 -07:00
Zach BrownandZach Brown aee017903b scoutfs: add hash helper
Add a quick header which calculates 64bit hashes by calculating the crc
of the two halves of a byte region.

Signed-off-by: Zach Brown <zab@versity.com>
2019-06-24 09:58:22 -07:00
Zach BrownandZach Brown a7fef3d7dd scoutfs: add listxattr_raw ioctl
Add an ioctl which can be used to iterate over the keys for all the
xattrs on an inode.  It is privileged, can see hidden inodes, and has an
iteration cursor so that it can make its way through very large numbers
of xattrs.

Signed-off-by: Zach Brown <zab@versity.com>
2019-06-24 09:58:22 -07:00
Zach BrownandZach Brown 019b5f6d6b scoutfs: add scoutfs xattr prefix and name tags
Add a scoutfs. xattr prefix which then defines a series of following
tags which can change the behaviour of the xattr.  We start with .hide.
which stops the xattr from showing up in listxattr.

Signed-off-by: Zach Brown <zab@versity.com>
2019-06-24 09:58:22 -07:00
Zach BrownandZach Brown a239f6093d scoutfs: add mount_options/ sysfs dir
Add a directory per mount that shows the values of all the mount
options.

Signed-off-by: Zach Brown <zab@versity.com>
2019-06-05 14:30:11 -07:00
Zach BrownandZach Brown 7d56d8f34f scoutfs: add .show_options
Add the vfs callback that prints mount options in /proc files.

Signed-off-by: Zach Brown <zab@versity.com>
2019-06-05 14:30:11 -07:00
Zach BrownandZach Brown c061ada671 scoutfs: mounts connect once server is listening
An elected leader writes a quorum block showing that it's elected before
it assumes exclusive access to the device and starts bringing up the
server.  This lets another later elected leader find and fence it if
something happens.

Other mounts were trying to connect to the server once this elected
quorum block was written and before the server was listening.  They'd
get conection refused, decide to elect a new leader, and try to fence
the server that's still running.

Now, they should have tried much harder to connect to the elected leader
instead of taking a single failed attempt as fatal.  But that's a
problem for another day that involves more work in balancing timeouts
and retries.

But mounts should not have tried try to connect to the server until its
listening.  That's easy to signal by adding a simple listening flag to
the quorum block.  Now mounts will only try to connect once they see the
listening flag and don't see these racey refused connections.

Signed-off-by: Zach Brown <zab@versity.com>
2019-05-30 15:01:00 -07:00
Zach BrownandZach Brown abd7ffc247 scoutfs: only trace read qourum blocks after io
We have trace points as blocks are read, but the reads are cached as
buffer heads.  The iteration helpers are used to referenced cached
blocks a few times in each voting cycle and we end up tracing cached
read blocks multiple times.  This uses a bit on the buffer_head to only
trace a cached block the first time it's read.

Signed-off-by: Zach Brown <zab@versity.com>
2019-05-30 15:01:00 -07:00
Zach BrownandZach Brown 8d505668fe scoutfs-utils: add quorum block listening flag
Signed-off-by: Zach Brown <zab@versity.com>
2019-05-30 15:00:56 -07:00
Zach BrownandZach Brown 4df35efbc0 scoutfs: show quorum state in sysfs
Add some sysfs files which show quorum state.  We store the state in
quorum_info off the super which is updates as we participate in
elections.

Signed-off-by: Zach Brown <zab@versity.com>
2019-05-30 13:51:02 -07:00
Zach BrownandZach Brown 2cc4f89ad5 scoutfs: add sysfs attrs wrappers
Add some helpers to manage the lifetime of groups of attributes in
sysfs.  We can wait until the sysfs files are no longer in use
before tearing down the data that they rely on.

Signed-off-by: Zach Brown <zab@versity.com>
2019-05-30 13:51:02 -07:00
Zach BrownandZach Brown da185b214b scoutfs: return non-zero status on error
The error return conventions were confused, resulting in main exiting
with success when command execution failed.

Signed-off-by: Zach Brown <zab@versity.com>
2019-05-30 13:45:57 -07:00
Zach BrownandZach Brown 336a6a155d scoutfs-utils: add setattr more command
Add a command that wraps the setattr_more ioctl.

Signed-off-by: Zach Brown <zab@versity.com>
2019-05-30 13:45:57 -07:00
Zach BrownandZach Brown ffe15c2d82 scoutfs-utils: add string parsing functions
We're starting to collect a few of these.  Let's put them in one place.

Signed-off-by: Zach Brown <zab@versity.com>
2019-05-30 13:45:57 -07:00
Zach BrownandZach Brown c010afa8ff scoutfs: add setattr_more ioctl
Add an ioctl that can be used by userspace to restore a file to its
offline state.  To do that it needs to set inode fields that are
otherwise not exposed and create an offline extent.

Signed-off-by: Zach Brown <zab@versity.com>
2019-05-30 13:45:52 -07:00
Zach BrownandZach Brown 0b6bc8789c scoutfs: don't leak btree block refs
Somewhere in the mists of time (around when we removed path tracking
which held refs to blocks?) walking blocks to migrate started leaking
btree block references.  It was providing a pointer so the walk gave it
the block it found but the caller was never dropping that ref.

It wasn't doing anything with the result of the walk so we just don't
provide a block pointer and the walk will drop the ref for us.  This
will stop leaking refs, effectively pinning the ring in memory.

Signed-off-by: Zach Brown <zab@versity.com>
2019-05-21 11:41:07 -07:00
Zach BrownandZach Brown 0988cbe1e9 scoutfs: track old and cur dirty btree blocks
To avoid overwriting live btree blocks we have to migrate them between
halves of the ring.  Each time we cross into a new half of the ring we
start migration all over again.

The intent was to slowly migrate the blocks over time.  We'd track dirty
blocks that came from the old and current halves and keep them in
balance.  This would keep the overhead of the migration low and spread
out through all at the start of the half that include migration.

But the calculation of current blocks was completely wrong.  It checked
the newly allocated block which is always in the current half.  It never
thought it was dirtying old blocks so it'd constantly migrate trying to
find them.  We'd effectively migrate every btree block during the first
transaction in each half.

This calculates if we're dirtying old or new blocks by the source of the
cow operation.  We now recognize when we dirty old blocks and will stop
migrating once we've migrated at least as many old blocks as we've
written new blocks.

Signed-off-by: Zach Brown <zab@versity.com>
2019-05-21 11:41:07 -07:00
Zach BrownandZach Brown e10033b34d scoutfs: migrate dirty btree blocks during wrap
We were seeing ring btree corruption that manifest as the server seeing
stale btree blocks as it tried to read all the btrees to migrate blocks
during a write.  A block it tried to read didn't match its reference.

It turned out that block wasn't being migrated.  It would get stuck
at a position in the ring.  Eventually new block writes would overwrite
it and then the next read would see corruption.

It wasn't being migrated because the block reading function didn't
realize that it had to migrate a dirty block.  The block was written in
a transaction at the end of the ring.   The ring wrapped during
the transaction and then migration tried to migrate the dirty block.
It wouldn't be dirtied, and thus be migrated, because it was already
dirty in the transaction.

The fix is to add more cases to the dirtying decision which takes
migration specifically into account.  We'll no longer short circuit
dirtying blocks for migration when they're in the old half of the ring
even though they're dirty.

Signed-off-by: Zach Brown <zab@versity.com>
2019-05-21 11:41:07 -07:00
Zach BrownandZach Brown e150ebc8d2 scoutfs: trace btree dirty blocks
Signed-off-by: Zach Brown <zab@versity.com>
2019-05-21 11:41:07 -07:00
Zach BrownandZach Brown 57da5fae4c scoutfs-utils: add waiting ioctl command
Add a quick command that lists the results of the new waiting ioctl.

Signed-off-by: Zach Brown <zab@versity.com>
2019-05-21 11:33:42 -07:00
Zach BrownandZach Brown 806ac0d8e6 scoutfs: fix mkfs option in README
Fix a quick option typo in the mkfs invocations in the readme.

Signed-off-by: Zach Brown <zab@versity.com>
2019-05-21 11:33:26 -07:00
Zach BrownandZach Brown a6782fc03f scoutfs: add data waiting
One of the core features of scoutfs is the ability to transparently
migrate file contents to and from an archive tier.  For this to be
transparent we need file system operations to trigger staging the file
contents back into the file system as needed.

This adds the infrastructure which operations use to wait for offline
extents to come online and which provides userspace with a list of
blocks that the operations are waiting for.

We add some waiting infrastructure that callers use to lock, check for
offline extents, and unlock and wait before checking again to see if
they're still offline.  We add these checks and waiting to data io
operations that could encounter offline extents.

This has to be done carefully so that we don't wait while holding locks
that would prevent staging.  We use per-task structures to discover when
we are the first user of a cluster lock on an inode, indicating that
it's safe for us to wait because we don't hold any locks.

And while we're waiting our operation is tracked and reported to
userspace through an ioctl.  This is a non-blocking ioctl, it's up to
userspace to decide how often to check and how large a region to stage.

Waiters are woken up when the file contents could have changed, not
specifically when we know that the extent has come online.  This lets us
wake waiters when their lock is revoked so that they can block waiting
to reacquire the lock and test the extents again.  It lets us provide
coherent demand staging across the cluster without fine grained waiting
protocols sent betwen the nodes.  It may result in some spurious wakeups
and work but hopefully it won't, and it's a very simple and functional
first pass.

Signed-off-by: Zach Brown <zab@versity.com>
2019-05-21 11:33:26 -07:00
Zach BrownandZach Brown cfa563a4a4 scoutfs: expand the per_task API
This adds some minor functionality to the per_task API for use by the
upcoming offline waiting work.

Add scoutfs_per_task_add_excl() so that a caller can tell if their task
was already put on a per-task list by their caller.

Make scoutfs_per_task_del() return a bool to indicate if the entry was
found on a list and was in fact deleted, or not.

Add scoutfs_per_task_init_entry() for initializing entries that aren't
declared on the stack.

Signed-off-by: Zach Brown <zab@versity.com>
2019-05-21 11:33:26 -07:00
Zach BrownandZach Brown 3a6392aee6 scoutfs: remove scoutfs_unlock_flags() prototype
There was an old prototype for an unlock variant that hasn't been around
for a while.  Remove it.

Signed-off-by: Zach Brown <zab@versity.com>
2019-05-21 11:33:26 -07:00
Zach BrownandZach Brown 7097d545cf scoutfs: make sure to set the sb blocksize
Since fill_super was originally written we've added use of buffer_head
IO by the btree and quorum voting.  We forgot to set the block size so
devices that didn't have the common 4k default, matching our block size,
would see errors.  Explicitly set it.

Signed-off-by: Zach Brown <zab@versity.com>
2019-05-21 11:33:26 -07:00
Zach BrownandZach Brown 77bd0c20ab scoutfs-utils: add flags to quorum block
Signed-off-by: Zach Brown <zab@versity.com>
2019-04-12 10:54:20 -07:00
Zach BrownandZach Brown 514418421c scoutfs-utils: add support for unmount_barrier
Signed-off-by: Zach Brown <zab@versity.com>
2019-04-12 10:54:20 -07:00
Zach BrownandZach Brown a9b46213b3 scoutfs-utils: remove ctrstat command
Remove the ctrstat command.  It was built back when we had a handful of
counters.  It's output format doesn't make much sense now that we have
an absolute ton of counters.  If we want fancy counter output in the
future we'd add it to the counters command.

Signed-off-by: Zach Brown <zab@versity.com>
2019-04-12 10:54:20 -07:00
Zach BrownandZach Brown 841fbc1b66 scoutfs-utils: add counters command
Add a command to output the sysfs counters for a volume, with the option
of generating a table that fits the terminal.

Signed-off-by: Zach Brown <zab@versity.com>
2019-04-12 10:54:20 -07:00
Zach BrownandZach Brown 3c9eeeb2ef scoutfs-utils: add transaction seq btree
Signed-off-by: Zach Brown <zab@versity.com>
2019-04-12 10:54:20 -07:00
Zach BrownandZach Brown 587760edb3 scoutfs-utils: add clock sync id to messages
Signed-off-by: Zach Brown <zab@versity.com>
2019-04-12 10:54:20 -07:00
Zach BrownandZach Brown 3d64c46fcd scoutfs-utils: add lock clients btree
Show the lock client btree entries in print.

Signed-off-by: Zach Brown <zab@versity.com>
2019-04-12 10:54:20 -07:00
Zach BrownandZach Brown 4c611474e8 scoutfs-utils: update for reliable messaging
Signed-off-by: Zach Brown <zab@versity.com>
2019-04-12 10:54:20 -07:00
Zach BrownandZach Brown 64bdda717c scoutfs-utils: move super id to block hdr magic
Move the magic value that identifies the super block into the block
header and use it for btree blocks as well.

Signed-off-by: Zach Brown <zab@versity.com>
2019-04-12 10:54:20 -07:00