diff options
author | Jeff Layton <jlayton@redhat.com> | 2010-10-06 19:51:11 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2010-10-07 14:18:00 -0400 |
commit | 9d002df492b14c690425d9785530371b6c1ccbca (patch) | |
tree | 6ed1a52d0e348e985f7bd194d22ee6e7854fa9e8 /fs/cifs/cifsglob.h | |
parent | c9928f7040a6e5f39e028bea500e0fde910d4a96 (diff) |
cifs: add routines to build sessions and tcons on the fly
This patch is rather large, but it's a bit difficult to do piecemeal...
For non-multiuser mounts, everything will basically work as it does
today. A call to cifs_sb_tlink will return the "master" tcon link.
Turn the tcon pointer in the cifs_sb into a radix tree that uses the
fsuid of the process as a key. The value is a new "tcon_link" struct
that contains info about a tcon that's under construction.
When a new process needs a tcon, it'll call cifs_sb_tcon. That will
then look up the tcon_link in the radix tree. If it exists and is
valid, it's returned.
If it doesn't exist, then we stuff a new tcon_link into the tree and
mark it as pending and then go and try to build the session/tcon.
If that works, the tcon pointer in the tcon_link is updated and the
pending flag is cleared.
If the construction fails, then we set the tcon pointer to an ERR_PTR
and clear the pending flag.
If the radix tree is searched and the tcon_link is marked pending
then we go to sleep and wait for the pending flag to be cleared.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifsglob.h')
-rw-r--r-- | fs/cifs/cifsglob.h | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index d5324853203b..9a7c472a153f 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -317,42 +317,36 @@ struct cifsTconInfo { | |||
317 | * "get" on the container. | 317 | * "get" on the container. |
318 | */ | 318 | */ |
319 | struct tcon_link { | 319 | struct tcon_link { |
320 | spinlock_t tl_lock; | 320 | unsigned long tl_index; |
321 | u32 tl_count; | 321 | unsigned long tl_flags; |
322 | u64 tl_time; | 322 | #define TCON_LINK_MASTER 0 |
323 | #define TCON_LINK_PENDING 1 | ||
324 | #define TCON_LINK_IN_TREE 2 | ||
325 | unsigned long tl_time; | ||
326 | atomic_t tl_count; | ||
323 | struct cifsTconInfo *tl_tcon; | 327 | struct cifsTconInfo *tl_tcon; |
324 | }; | 328 | }; |
325 | 329 | ||
326 | static inline struct tcon_link * | 330 | extern struct tcon_link *cifs_sb_tlink(struct cifs_sb_info *cifs_sb); |
327 | cifs_sb_tlink(struct cifs_sb_info *cifs_sb) | ||
328 | { | ||
329 | return (struct tcon_link *)cifs_sb->ptcon; | ||
330 | } | ||
331 | 331 | ||
332 | static inline struct cifsTconInfo * | 332 | static inline struct cifsTconInfo * |
333 | tlink_tcon(struct tcon_link *tlink) | 333 | tlink_tcon(struct tcon_link *tlink) |
334 | { | 334 | { |
335 | return (struct cifsTconInfo *)tlink; | 335 | return tlink->tl_tcon; |
336 | } | 336 | } |
337 | 337 | ||
338 | static inline void | 338 | extern void cifs_put_tlink(struct tcon_link *tlink); |
339 | cifs_put_tlink(struct tcon_link *tlink) | ||
340 | { | ||
341 | return; | ||
342 | } | ||
343 | 339 | ||
344 | static inline struct tcon_link * | 340 | static inline struct tcon_link * |
345 | cifs_get_tlink(struct tcon_link *tlink) | 341 | cifs_get_tlink(struct tcon_link *tlink) |
346 | { | 342 | { |
343 | if (tlink && !IS_ERR(tlink)) | ||
344 | atomic_inc(&tlink->tl_count); | ||
347 | return tlink; | 345 | return tlink; |
348 | } | 346 | } |
349 | 347 | ||
350 | /* This function is always expected to succeed */ | 348 | /* This function is always expected to succeed */ |
351 | static inline struct cifsTconInfo * | 349 | extern struct cifsTconInfo *cifs_sb_master_tcon(struct cifs_sb_info *cifs_sb); |
352 | cifs_sb_master_tcon(struct cifs_sb_info *cifs_sb) | ||
353 | { | ||
354 | return cifs_sb->ptcon; | ||
355 | } | ||
356 | 350 | ||
357 | /* | 351 | /* |
358 | * This info hangs off the cifsFileInfo structure, pointed to by llist. | 352 | * This info hangs off the cifsFileInfo structure, pointed to by llist. |