aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-16 14:41:22 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-16 14:41:22 -0500
commit487e2c9f44c4b5ea23bfe87bb34679f7297a0bce (patch)
treee9dcf16175078ae2bed9a2fc120e6bd0b28f48e9 /include
parentb630a23a731a436f9edbd9fa00739aaa3e174c15 (diff)
parent98bf40cd99fcfed0705812b6cbdbb3b441a42970 (diff)
Merge tag 'afs-next-20171113' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
Pull AFS updates from David Howells: "kAFS filesystem driver overhaul. The major points of the overhaul are: (1) Preliminary groundwork is laid for supporting network-namespacing of kAFS. The remainder of the namespacing work requires some way to pass namespace information to submounts triggered by an automount. This requires something like the mount overhaul that's in progress. (2) sockaddr_rxrpc is used in preference to in_addr for holding addresses internally and add support for talking to the YFS VL server. With this, kAFS can do everything over IPv6 as well as IPv4 if it's talking to servers that support it. (3) Callback handling is overhauled to be generally passive rather than active. 'Callbacks' are promises by the server to tell us about data and metadata changes. Callbacks are now checked when we next touch an inode rather than actively going and looking for it where possible. (4) File access permit caching is overhauled to store the caching information per-inode rather than per-directory, shared over subordinate files. Whilst older AFS servers only allow ACLs on directories (shared to the files in that directory), newer AFS servers break that restriction. To improve memory usage and to make it easier to do mass-key removal, permit combinations are cached and shared. (5) Cell database management is overhauled to allow lighter locks to be used and to make cell records autonomous state machines that look after getting their own DNS records and cleaning themselves up, in particular preventing races in acquiring and relinquishing the fscache token for the cell. (6) Volume caching is overhauled. The afs_vlocation record is got rid of to simplify things and the superblock is now keyed on the cell and the numeric volume ID only. The volume record is tied to a superblock and normal superblock management is used to mediate the lifetime of the volume fscache token. (7) File server record caching is overhauled to make server records independent of cells and volumes. A server can be in multiple cells (in such a case, the administrator must make sure that the VL services for all cells correctly reflect the volumes shared between those cells). Server records are now indexed using the UUID of the server rather than the address since a server can have multiple addresses. (8) File server rotation is overhauled to handle VMOVED, VBUSY (and similar), VOFFLINE and VNOVOL indications and to handle rotation both of servers and addresses of those servers. The rotation will also wait and retry if the server says it is busy. (9) Data writeback is overhauled. Each inode no longer stores a list of modified sections tagged with the key that authorised it in favour of noting the modified region of a page in page->private and storing a list of keys that made modifications in the inode. This simplifies things and allows other keys to be used to actually write to the server if a key that made a modification becomes useless. (10) Writable mmap() is implemented. This allows a kernel to be build entirely on AFS. Note that Pre AFS-3.4 servers are no longer supported, though this can be added back if necessary (AFS-3.4 was released in 1998)" * tag 'afs-next-20171113' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs: (35 commits) afs: Protect call->state changes against signals afs: Trace page dirty/clean afs: Implement shared-writeable mmap afs: Get rid of the afs_writeback record afs: Introduce a file-private data record afs: Use a dynamic port if 7001 is in use afs: Fix directory read/modify race afs: Trace the sending of pages afs: Trace the initiation and completion of client calls afs: Fix documentation on # vs % prefix in mount source specification afs: Fix total-length calculation for multiple-page send afs: Only progress call state at end of Tx phase from rxrpc callback afs: Make use of the YFS service upgrade to fully support IPv6 afs: Overhaul volume and server record caching and fileserver rotation afs: Move server rotation code into its own file afs: Add an address list concept afs: Overhaul cell database management afs: Overhaul permit caching afs: Overhaul the callback handling afs: Rename struct afs_call server member to cm_server ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/wait_bit.h15
-rw-r--r--include/trace/events/afs.h293
-rw-r--r--include/uapi/linux/magic.h1
3 files changed, 303 insertions, 6 deletions
diff --git a/include/linux/wait_bit.h b/include/linux/wait_bit.h
index af0d495430d7..61b39eaf7cad 100644
--- a/include/linux/wait_bit.h
+++ b/include/linux/wait_bit.h
@@ -26,6 +26,8 @@ struct wait_bit_queue_entry {
26 { .flags = p, .bit_nr = WAIT_ATOMIC_T_BIT_NR, } 26 { .flags = p, .bit_nr = WAIT_ATOMIC_T_BIT_NR, }
27 27
28typedef int wait_bit_action_f(struct wait_bit_key *key, int mode); 28typedef int wait_bit_action_f(struct wait_bit_key *key, int mode);
29typedef int wait_atomic_t_action_f(atomic_t *counter, unsigned int mode);
30
29void __wake_up_bit(struct wait_queue_head *wq_head, void *word, int bit); 31void __wake_up_bit(struct wait_queue_head *wq_head, void *word, int bit);
30int __wait_on_bit(struct wait_queue_head *wq_head, struct wait_bit_queue_entry *wbq_entry, wait_bit_action_f *action, unsigned int mode); 32int __wait_on_bit(struct wait_queue_head *wq_head, struct wait_bit_queue_entry *wbq_entry, wait_bit_action_f *action, unsigned int mode);
31int __wait_on_bit_lock(struct wait_queue_head *wq_head, struct wait_bit_queue_entry *wbq_entry, wait_bit_action_f *action, unsigned int mode); 33int __wait_on_bit_lock(struct wait_queue_head *wq_head, struct wait_bit_queue_entry *wbq_entry, wait_bit_action_f *action, unsigned int mode);
@@ -34,7 +36,7 @@ void wake_up_atomic_t(atomic_t *p);
34int out_of_line_wait_on_bit(void *word, int, wait_bit_action_f *action, unsigned int mode); 36int out_of_line_wait_on_bit(void *word, int, wait_bit_action_f *action, unsigned int mode);
35int out_of_line_wait_on_bit_timeout(void *word, int, wait_bit_action_f *action, unsigned int mode, unsigned long timeout); 37int out_of_line_wait_on_bit_timeout(void *word, int, wait_bit_action_f *action, unsigned int mode, unsigned long timeout);
36int out_of_line_wait_on_bit_lock(void *word, int, wait_bit_action_f *action, unsigned int mode); 38int out_of_line_wait_on_bit_lock(void *word, int, wait_bit_action_f *action, unsigned int mode);
37int out_of_line_wait_on_atomic_t(atomic_t *p, int (*)(atomic_t *), unsigned int mode); 39int out_of_line_wait_on_atomic_t(atomic_t *p, wait_atomic_t_action_f action, unsigned int mode);
38struct wait_queue_head *bit_waitqueue(void *word, int bit); 40struct wait_queue_head *bit_waitqueue(void *word, int bit);
39extern void __init wait_bit_init(void); 41extern void __init wait_bit_init(void);
40 42
@@ -51,10 +53,11 @@ int wake_bit_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync
51 }, \ 53 }, \
52 } 54 }
53 55
54extern int bit_wait(struct wait_bit_key *key, int bit); 56extern int bit_wait(struct wait_bit_key *key, int mode);
55extern int bit_wait_io(struct wait_bit_key *key, int bit); 57extern int bit_wait_io(struct wait_bit_key *key, int mode);
56extern int bit_wait_timeout(struct wait_bit_key *key, int bit); 58extern int bit_wait_timeout(struct wait_bit_key *key, int mode);
57extern int bit_wait_io_timeout(struct wait_bit_key *key, int bit); 59extern int bit_wait_io_timeout(struct wait_bit_key *key, int mode);
60extern int atomic_t_wait(atomic_t *counter, unsigned int mode);
58 61
59/** 62/**
60 * wait_on_bit - wait for a bit to be cleared 63 * wait_on_bit - wait for a bit to be cleared
@@ -251,7 +254,7 @@ wait_on_bit_lock_action(unsigned long *word, int bit, wait_bit_action_f *action,
251 * outside of the target 'word'. 254 * outside of the target 'word'.
252 */ 255 */
253static inline 256static inline
254int wait_on_atomic_t(atomic_t *val, int (*action)(atomic_t *), unsigned mode) 257int wait_on_atomic_t(atomic_t *val, wait_atomic_t_action_f action, unsigned mode)
255{ 258{
256 might_sleep(); 259 might_sleep();
257 if (atomic_read(val) == 0) 260 if (atomic_read(val) == 0)
diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h
index 8b95c16b7045..6b59c63a8e51 100644
--- a/include/trace/events/afs.h
+++ b/include/trace/events/afs.h
@@ -30,6 +30,38 @@ enum afs_call_trace {
30 afs_call_trace_work, 30 afs_call_trace_work,
31}; 31};
32 32
33enum afs_fs_operation {
34 afs_FS_FetchData = 130, /* AFS Fetch file data */
35 afs_FS_FetchStatus = 132, /* AFS Fetch file status */
36 afs_FS_StoreData = 133, /* AFS Store file data */
37 afs_FS_StoreStatus = 135, /* AFS Store file status */
38 afs_FS_RemoveFile = 136, /* AFS Remove a file */
39 afs_FS_CreateFile = 137, /* AFS Create a file */
40 afs_FS_Rename = 138, /* AFS Rename or move a file or directory */
41 afs_FS_Symlink = 139, /* AFS Create a symbolic link */
42 afs_FS_Link = 140, /* AFS Create a hard link */
43 afs_FS_MakeDir = 141, /* AFS Create a directory */
44 afs_FS_RemoveDir = 142, /* AFS Remove a directory */
45 afs_FS_GetVolumeInfo = 148, /* AFS Get information about a volume */
46 afs_FS_GetVolumeStatus = 149, /* AFS Get volume status information */
47 afs_FS_GetRootVolume = 151, /* AFS Get root volume name */
48 afs_FS_SetLock = 156, /* AFS Request a file lock */
49 afs_FS_ExtendLock = 157, /* AFS Extend a file lock */
50 afs_FS_ReleaseLock = 158, /* AFS Release a file lock */
51 afs_FS_Lookup = 161, /* AFS lookup file in directory */
52 afs_FS_FetchData64 = 65537, /* AFS Fetch file data */
53 afs_FS_StoreData64 = 65538, /* AFS Store file data */
54 afs_FS_GiveUpAllCallBacks = 65539, /* AFS Give up all our callbacks on a server */
55 afs_FS_GetCapabilities = 65540, /* AFS Get FS server capabilities */
56};
57
58enum afs_vl_operation {
59 afs_VL_GetEntryByNameU = 527, /* AFS Get Vol Entry By Name operation ID */
60 afs_VL_GetAddrsU = 533, /* AFS Get FS server addresses */
61 afs_YFSVL_GetEndpoints = 64002, /* YFS Get FS & Vol server addresses */
62 afs_VL_GetCapabilities = 65537, /* AFS Get VL server capabilities */
63};
64
33#endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */ 65#endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */
34 66
35/* 67/*
@@ -42,6 +74,37 @@ enum afs_call_trace {
42 EM(afs_call_trace_wake, "WAKE ") \ 74 EM(afs_call_trace_wake, "WAKE ") \
43 E_(afs_call_trace_work, "WORK ") 75 E_(afs_call_trace_work, "WORK ")
44 76
77#define afs_fs_operations \
78 EM(afs_FS_FetchData, "FS.FetchData") \
79 EM(afs_FS_FetchStatus, "FS.FetchStatus") \
80 EM(afs_FS_StoreData, "FS.StoreData") \
81 EM(afs_FS_StoreStatus, "FS.StoreStatus") \
82 EM(afs_FS_RemoveFile, "FS.RemoveFile") \
83 EM(afs_FS_CreateFile, "FS.CreateFile") \
84 EM(afs_FS_Rename, "FS.Rename") \
85 EM(afs_FS_Symlink, "FS.Symlink") \
86 EM(afs_FS_Link, "FS.Link") \
87 EM(afs_FS_MakeDir, "FS.MakeDir") \
88 EM(afs_FS_RemoveDir, "FS.RemoveDir") \
89 EM(afs_FS_GetVolumeInfo, "FS.GetVolumeInfo") \
90 EM(afs_FS_GetVolumeStatus, "FS.GetVolumeStatus") \
91 EM(afs_FS_GetRootVolume, "FS.GetRootVolume") \
92 EM(afs_FS_SetLock, "FS.SetLock") \
93 EM(afs_FS_ExtendLock, "FS.ExtendLock") \
94 EM(afs_FS_ReleaseLock, "FS.ReleaseLock") \
95 EM(afs_FS_Lookup, "FS.Lookup") \
96 EM(afs_FS_FetchData64, "FS.FetchData64") \
97 EM(afs_FS_StoreData64, "FS.StoreData64") \
98 EM(afs_FS_GiveUpAllCallBacks, "FS.GiveUpAllCallBacks") \
99 E_(afs_FS_GetCapabilities, "FS.GetCapabilities")
100
101#define afs_vl_operations \
102 EM(afs_VL_GetEntryByNameU, "VL.GetEntryByNameU") \
103 EM(afs_VL_GetAddrsU, "VL.GetAddrsU") \
104 EM(afs_YFSVL_GetEndpoints, "YFSVL.GetEndpoints") \
105 E_(afs_VL_GetCapabilities, "VL.GetCapabilities")
106
107
45/* 108/*
46 * Export enum symbols via userspace. 109 * Export enum symbols via userspace.
47 */ 110 */
@@ -51,6 +114,8 @@ enum afs_call_trace {
51#define E_(a, b) TRACE_DEFINE_ENUM(a); 114#define E_(a, b) TRACE_DEFINE_ENUM(a);
52 115
53afs_call_traces; 116afs_call_traces;
117afs_fs_operations;
118afs_vl_operations;
54 119
55/* 120/*
56 * Now redefine the EM() and E_() macros to map the enums to the strings that 121 * Now redefine the EM() and E_() macros to map the enums to the strings that
@@ -178,6 +243,234 @@ TRACE_EVENT(afs_call,
178 __entry->where) 243 __entry->where)
179 ); 244 );
180 245
246TRACE_EVENT(afs_make_fs_call,
247 TP_PROTO(struct afs_call *call, const struct afs_fid *fid),
248
249 TP_ARGS(call, fid),
250
251 TP_STRUCT__entry(
252 __field(struct afs_call *, call )
253 __field(enum afs_fs_operation, op )
254 __field_struct(struct afs_fid, fid )
255 ),
256
257 TP_fast_assign(
258 __entry->call = call;
259 __entry->op = call->operation_ID;
260 if (fid) {
261 __entry->fid = *fid;
262 } else {
263 __entry->fid.vid = 0;
264 __entry->fid.vnode = 0;
265 __entry->fid.unique = 0;
266 }
267 ),
268
269 TP_printk("c=%p %06x:%06x:%06x %s",
270 __entry->call,
271 __entry->fid.vid,
272 __entry->fid.vnode,
273 __entry->fid.unique,
274 __print_symbolic(__entry->op, afs_fs_operations))
275 );
276
277TRACE_EVENT(afs_make_vl_call,
278 TP_PROTO(struct afs_call *call),
279
280 TP_ARGS(call),
281
282 TP_STRUCT__entry(
283 __field(struct afs_call *, call )
284 __field(enum afs_vl_operation, op )
285 ),
286
287 TP_fast_assign(
288 __entry->call = call;
289 __entry->op = call->operation_ID;
290 ),
291
292 TP_printk("c=%p %s",
293 __entry->call,
294 __print_symbolic(__entry->op, afs_vl_operations))
295 );
296
297TRACE_EVENT(afs_call_done,
298 TP_PROTO(struct afs_call *call),
299
300 TP_ARGS(call),
301
302 TP_STRUCT__entry(
303 __field(struct afs_call *, call )
304 __field(struct rxrpc_call *, rx_call )
305 __field(int, ret )
306 __field(u32, abort_code )
307 ),
308
309 TP_fast_assign(
310 __entry->call = call;
311 __entry->rx_call = call->rxcall;
312 __entry->ret = call->error;
313 __entry->abort_code = call->abort_code;
314 ),
315
316 TP_printk(" c=%p ret=%d ab=%d [%p]",
317 __entry->call,
318 __entry->ret,
319 __entry->abort_code,
320 __entry->rx_call)
321 );
322
323TRACE_EVENT(afs_send_pages,
324 TP_PROTO(struct afs_call *call, struct msghdr *msg,
325 pgoff_t first, pgoff_t last, unsigned int offset),
326
327 TP_ARGS(call, msg, first, last, offset),
328
329 TP_STRUCT__entry(
330 __field(struct afs_call *, call )
331 __field(pgoff_t, first )
332 __field(pgoff_t, last )
333 __field(unsigned int, nr )
334 __field(unsigned int, bytes )
335 __field(unsigned int, offset )
336 __field(unsigned int, flags )
337 ),
338
339 TP_fast_assign(
340 __entry->call = call;
341 __entry->first = first;
342 __entry->last = last;
343 __entry->nr = msg->msg_iter.nr_segs;
344 __entry->bytes = msg->msg_iter.count;
345 __entry->offset = offset;
346 __entry->flags = msg->msg_flags;
347 ),
348
349 TP_printk(" c=%p %lx-%lx-%lx b=%x o=%x f=%x",
350 __entry->call,
351 __entry->first, __entry->first + __entry->nr - 1, __entry->last,
352 __entry->bytes, __entry->offset,
353 __entry->flags)
354 );
355
356TRACE_EVENT(afs_sent_pages,
357 TP_PROTO(struct afs_call *call, pgoff_t first, pgoff_t last,
358 pgoff_t cursor, int ret),
359
360 TP_ARGS(call, first, last, cursor, ret),
361
362 TP_STRUCT__entry(
363 __field(struct afs_call *, call )
364 __field(pgoff_t, first )
365 __field(pgoff_t, last )
366 __field(pgoff_t, cursor )
367 __field(int, ret )
368 ),
369
370 TP_fast_assign(
371 __entry->call = call;
372 __entry->first = first;
373 __entry->last = last;
374 __entry->cursor = cursor;
375 __entry->ret = ret;
376 ),
377
378 TP_printk(" c=%p %lx-%lx c=%lx r=%d",
379 __entry->call,
380 __entry->first, __entry->last,
381 __entry->cursor, __entry->ret)
382 );
383
384TRACE_EVENT(afs_dir_check_failed,
385 TP_PROTO(struct afs_vnode *vnode, loff_t off, loff_t i_size),
386
387 TP_ARGS(vnode, off, i_size),
388
389 TP_STRUCT__entry(
390 __field(struct afs_vnode *, vnode )
391 __field(loff_t, off )
392 __field(loff_t, i_size )
393 ),
394
395 TP_fast_assign(
396 __entry->vnode = vnode;
397 __entry->off = off;
398 __entry->i_size = i_size;
399 ),
400
401 TP_printk("vn=%p %llx/%llx",
402 __entry->vnode, __entry->off, __entry->i_size)
403 );
404
405/*
406 * We use page->private to hold the amount of the page that we've written to,
407 * splitting the field into two parts. However, we need to represent a range
408 * 0...PAGE_SIZE inclusive, so we can't support 64K pages on a 32-bit system.
409 */
410#if PAGE_SIZE > 32768
411#define AFS_PRIV_MAX 0xffffffff
412#define AFS_PRIV_SHIFT 32
413#else
414#define AFS_PRIV_MAX 0xffff
415#define AFS_PRIV_SHIFT 16
416#endif
417
418TRACE_EVENT(afs_page_dirty,
419 TP_PROTO(struct afs_vnode *vnode, const char *where,
420 pgoff_t page, unsigned long priv),
421
422 TP_ARGS(vnode, where, page, priv),
423
424 TP_STRUCT__entry(
425 __field(struct afs_vnode *, vnode )
426 __field(const char *, where )
427 __field(pgoff_t, page )
428 __field(unsigned long, priv )
429 ),
430
431 TP_fast_assign(
432 __entry->vnode = vnode;
433 __entry->where = where;
434 __entry->page = page;
435 __entry->priv = priv;
436 ),
437
438 TP_printk("vn=%p %lx %s %lu-%lu",
439 __entry->vnode, __entry->page, __entry->where,
440 __entry->priv & AFS_PRIV_MAX,
441 __entry->priv >> AFS_PRIV_SHIFT)
442 );
443
444TRACE_EVENT(afs_call_state,
445 TP_PROTO(struct afs_call *call,
446 enum afs_call_state from,
447 enum afs_call_state to,
448 int ret, u32 remote_abort),
449
450 TP_ARGS(call, from, to, ret, remote_abort),
451
452 TP_STRUCT__entry(
453 __field(struct afs_call *, call )
454 __field(enum afs_call_state, from )
455 __field(enum afs_call_state, to )
456 __field(int, ret )
457 __field(u32, abort )
458 ),
459
460 TP_fast_assign(
461 __entry->call = call;
462 __entry->from = from;
463 __entry->to = to;
464 __entry->ret = ret;
465 __entry->abort = remote_abort;
466 ),
467
468 TP_printk("c=%p %u->%u r=%d ab=%d",
469 __entry->call,
470 __entry->from, __entry->to,
471 __entry->ret, __entry->abort)
472 );
473
181#endif /* _TRACE_AFS_H */ 474#endif /* _TRACE_AFS_H */
182 475
183/* This part must be outside protection */ 476/* This part must be outside protection */
diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h
index aa50113ebe5b..1a6fee974116 100644
--- a/include/uapi/linux/magic.h
+++ b/include/uapi/linux/magic.h
@@ -47,6 +47,7 @@
47#define OPENPROM_SUPER_MAGIC 0x9fa1 47#define OPENPROM_SUPER_MAGIC 0x9fa1
48#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ 48#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */
49#define QNX6_SUPER_MAGIC 0x68191122 /* qnx6 fs detection */ 49#define QNX6_SUPER_MAGIC 0x68191122 /* qnx6 fs detection */
50#define AFS_FS_MAGIC 0x6B414653
50 51
51#define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ 52#define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */
52 /* used by file system utilities that 53 /* used by file system utilities that