Skip to content

Commit

Permalink
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
Browse files Browse the repository at this point in the history
* git://git.linux-nfs.org/pub/linux/nfs-2.6: (51 commits)
  nfs: remove nfs_put_link()
  nfs-build-fix-99
  git-nfs-build-fixes
  Merge branch 'odirect'
  NFS: alloc nfs_read/write_data as direct I/O is scheduled
  NFS: Eliminate nfs_get_user_pages()
  NFS: refactor nfs_direct_free_user_pages
  NFS: remove user_addr, user_count, and pos from nfs_direct_req
  NFS: "open code" the NFS direct write rescheduler
  NFS: Separate functions for counting outstanding NFS direct I/Os
  NLM: Fix reclaim races
  NLM: sem to mutex conversion
  locks.c: add the fl_owner to nlm_compare_locks
  NFS: Display the chosen RPCSEC_GSS security flavour in /proc/mounts
  NFS: Split fs/nfs/inode.c
  NFS: Fix typo in nfs_do_clone_mount()
  NFS: Fix compile errors introduced by referrals patches
  NFSv4: Ensure that referral mounts bind to a reserved port
  NFSv4: A root pathname is sent as a zero component4
  NFSv4: Follow a referral
  ...
  • Loading branch information
Linus Torvalds committed Jun 25, 2006
2 parents 25581ad + 76a9f26 commit 1d77062
Show file tree
Hide file tree
Showing 59 changed files with 3,065 additions and 1,513 deletions.
2 changes: 1 addition & 1 deletion Documentation/filesystems/automount-support.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ following procedure:

(2) Have the follow_link() op do the following steps:

(a) Call do_kern_mount() to call the appropriate filesystem to set up a
(a) Call vfs_kern_mount() to call the appropriate filesystem to set up a
superblock and gain a vfsmount structure representing it.

(b) Copy the nameidata provided as an argument and substitute the dentry
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/core/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ static int create_special_files (void)
ignore_mount = 1;

/* create the devices special file */
retval = simple_pin_fs("usbfs", &usbfs_mount, &usbfs_mount_count);
retval = simple_pin_fs(&usb_fs_type, &usbfs_mount, &usbfs_mount_count);
if (retval) {
err ("Unable to get usbfs mount");
goto exit;
Expand Down
7 changes: 4 additions & 3 deletions fs/9p/vfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,12 @@ static int v9fs_show_options(struct seq_file *m, struct vfsmount *mnt)
}

static void
v9fs_umount_begin(struct super_block *sb)
v9fs_umount_begin(struct vfsmount *vfsmnt, int flags)
{
struct v9fs_session_info *v9ses = sb->s_fs_info;
struct v9fs_session_info *v9ses = vfsmnt->mnt_sb->s_fs_info;

v9fs_session_cancel(v9ses);
if (flags & MNT_FORCE)
v9fs_session_cancel(v9ses);
}

static struct super_operations v9fs_super_ops = {
Expand Down
2 changes: 1 addition & 1 deletion fs/afs/mntpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)

/* try and do the mount */
kdebug("--- attempting mount %s -o %s ---", devname, options);
mnt = do_kern_mount("afs", 0, devname, options);
mnt = vfs_kern_mount(&afs_fs_type, 0, devname, options);
kdebug("--- mount result %p ---", mnt);

free_page((unsigned long) devname);
Expand Down
2 changes: 1 addition & 1 deletion fs/afs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static void afs_put_super(struct super_block *sb);

static void afs_destroy_inode(struct inode *inode);

static struct file_system_type afs_fs_type = {
struct file_system_type afs_fs_type = {
.owner = THIS_MODULE,
.name = "afs",
.get_sb = afs_get_sb,
Expand Down
2 changes: 2 additions & 0 deletions fs/afs/super.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ static inline struct afs_super_info *AFS_FS_S(struct super_block *sb)
return sb->s_fs_info;
}

extern struct file_system_type afs_fs_type;

#endif /* __KERNEL__ */

#endif /* _LINUX_AFS_SUPER_H */
3 changes: 2 additions & 1 deletion fs/binfmt_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ typedef struct {
} Node;

static DEFINE_RWLOCK(entries_lock);
static struct file_system_type bm_fs_type;
static struct vfsmount *bm_mnt;
static int entry_count;

Expand Down Expand Up @@ -637,7 +638,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
if (!inode)
goto out2;

err = simple_pin_fs("binfmt_misc", &bm_mnt, &entry_count);
err = simple_pin_fs(&bm_fs_type, &bm_mnt, &entry_count);
if (err) {
iput(inode);
inode = NULL;
Expand Down
6 changes: 4 additions & 2 deletions fs/cifs/cifsfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,14 @@ static struct quotactl_ops cifs_quotactl_ops = {
#endif

#ifdef CONFIG_CIFS_EXPERIMENTAL
static void cifs_umount_begin(struct super_block * sblock)
static void cifs_umount_begin(struct vfsmount * vfsmnt, int flags)
{
struct cifs_sb_info *cifs_sb;
struct cifsTconInfo * tcon;

cifs_sb = CIFS_SB(sblock);
if (!(flags & MNT_FORCE))
return;
cifs_sb = CIFS_SB(vfsmnt->mnt_sb);
if(cifs_sb == NULL)
return;

Expand Down
2 changes: 1 addition & 1 deletion fs/configfs/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static struct file_system_type configfs_fs_type = {

int configfs_pin_fs(void)
{
return simple_pin_fs("configfs", &configfs_mount,
return simple_pin_fs(&configfs_fs_type, &configfs_mount,
&configfs_mnt_count);
}

Expand Down
2 changes: 1 addition & 1 deletion fs/debugfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ struct dentry *debugfs_create_file(const char *name, mode_t mode,

pr_debug("debugfs: creating file '%s'\n",name);

error = simple_pin_fs("debugfs", &debugfs_mount, &debugfs_mount_count);
error = simple_pin_fs(&debug_fs_type, &debugfs_mount, &debugfs_mount_count);
if (error)
goto exit;

Expand Down
5 changes: 3 additions & 2 deletions fs/fuse/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,10 @@ struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid,
return inode;
}

static void fuse_umount_begin(struct super_block *sb)
static void fuse_umount_begin(struct vfsmount *vfsmnt, int flags)
{
fuse_abort_conn(get_fuse_conn_super(sb));
if (flags & MNT_FORCE)
fuse_abort_conn(get_fuse_conn_super(vfsmnt->mnt_sb));
}

static void fuse_put_super(struct super_block *sb)
Expand Down
4 changes: 2 additions & 2 deletions fs/libfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,13 @@ int simple_fill_super(struct super_block *s, int magic, struct tree_descr *files

static DEFINE_SPINLOCK(pin_fs_lock);

int simple_pin_fs(char *name, struct vfsmount **mount, int *count)
int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *count)
{
struct vfsmount *mnt = NULL;
spin_lock(&pin_fs_lock);
if (unlikely(!*mount)) {
spin_unlock(&pin_fs_lock);
mnt = do_kern_mount(name, 0, name, NULL);
mnt = vfs_kern_mount(type, 0, type->name, NULL);
if (IS_ERR(mnt))
return PTR_ERR(mnt);
spin_lock(&pin_fs_lock);
Expand Down
39 changes: 25 additions & 14 deletions fs/lockd/clntlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,10 @@ u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *lock)
* Someone has sent us an SM_NOTIFY. Ensure we bind to the new port number,
* that we mark locks for reclaiming, and that we bump the pseudo NSM state.
*/
static inline
void nlmclnt_prepare_reclaim(struct nlm_host *host, u32 newstate)
static void nlmclnt_prepare_reclaim(struct nlm_host *host)
{
down_write(&host->h_rwsem);
host->h_monitored = 0;
host->h_nsmstate = newstate;
host->h_state++;
host->h_nextrebind = 0;
nlm_rebind_host(host);
Expand All @@ -164,19 +163,24 @@ void nlmclnt_prepare_reclaim(struct nlm_host *host, u32 newstate)
dprintk("NLM: reclaiming locks for host %s", host->h_name);
}

static void nlmclnt_finish_reclaim(struct nlm_host *host)
{
host->h_reclaiming = 0;
up_write(&host->h_rwsem);
dprintk("NLM: done reclaiming locks for host %s", host->h_name);
}

/*
* Reclaim all locks on server host. We do this by spawning a separate
* reclaimer thread.
*/
void
nlmclnt_recovery(struct nlm_host *host, u32 newstate)
{
if (host->h_reclaiming++) {
if (host->h_nsmstate == newstate)
return;
nlmclnt_prepare_reclaim(host, newstate);
} else {
nlmclnt_prepare_reclaim(host, newstate);
if (host->h_nsmstate == newstate)
return;
host->h_nsmstate = newstate;
if (!host->h_reclaiming++) {
nlm_get_host(host);
__module_get(THIS_MODULE);
if (kernel_thread(reclaimer, host, CLONE_KERNEL) < 0)
Expand All @@ -190,6 +194,7 @@ reclaimer(void *ptr)
struct nlm_host *host = (struct nlm_host *) ptr;
struct nlm_wait *block;
struct file_lock *fl, *next;
u32 nsmstate;

daemonize("%s-reclaim", host->h_name);
allow_signal(SIGKILL);
Expand All @@ -199,19 +204,25 @@ reclaimer(void *ptr)
lock_kernel();
lockd_up();

nlmclnt_prepare_reclaim(host);
/* First, reclaim all locks that have been marked. */
restart:
nsmstate = host->h_nsmstate;
list_for_each_entry_safe(fl, next, &host->h_reclaim, fl_u.nfs_fl.list) {
list_del_init(&fl->fl_u.nfs_fl.list);

if (signalled())
continue;
if (nlmclnt_reclaim(host, fl) == 0)
list_add_tail(&fl->fl_u.nfs_fl.list, &host->h_granted);
goto restart;
if (nlmclnt_reclaim(host, fl) != 0)
continue;
list_add_tail(&fl->fl_u.nfs_fl.list, &host->h_granted);
if (host->h_nsmstate != nsmstate) {
/* Argh! The server rebooted again! */
list_splice_init(&host->h_granted, &host->h_reclaim);
goto restart;
}
}

host->h_reclaiming = 0;
nlmclnt_finish_reclaim(host);

/* Now, wake up all processes that sleep on a blocked lock */
list_for_each_entry(block, &nlm_blocked, b_list) {
Expand Down
14 changes: 13 additions & 1 deletion fs/lockd/clntproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,10 @@ nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl)
}

block = nlmclnt_prepare_block(host, fl);
again:
for(;;) {
/* Reboot protection */
fl->fl_u.nfs_fl.state = host->h_state;
status = nlmclnt_call(req, NLMPROC_LOCK);
if (status < 0)
goto out_unblock;
Expand All @@ -531,10 +534,16 @@ nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl)
}

if (resp->status == NLM_LCK_GRANTED) {
fl->fl_u.nfs_fl.state = host->h_state;
down_read(&host->h_rwsem);
/* Check whether or not the server has rebooted */
if (fl->fl_u.nfs_fl.state != host->h_state) {
up_read(&host->h_rwsem);
goto again;
}
fl->fl_flags |= FL_SLEEP;
/* Ensure the resulting lock will get added to granted list */
do_vfs_lock(fl);
up_read(&host->h_rwsem);
}
status = nlm_stat_to_errno(resp->status);
out_unblock:
Expand Down Expand Up @@ -596,6 +605,7 @@ nlmclnt_reclaim(struct nlm_host *host, struct file_lock *fl)
static int
nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl)
{
struct nlm_host *host = req->a_host;
struct nlm_res *resp = &req->a_res;
int status;

Expand All @@ -604,7 +614,9 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl)
* request, or to deny it with NLM_LCK_DENIED_GRACE_PERIOD. In either
* case, we want to unlock.
*/
down_read(&host->h_rwsem);
do_vfs_lock(fl);
up_read(&host->h_rwsem);

if (req->a_flags & RPC_TASK_ASYNC)
return nlm_async_call(req, NLMPROC_UNLOCK, &nlmclnt_unlock_ops);
Expand Down
9 changes: 5 additions & 4 deletions fs/lockd/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,12 @@ nlm_lookup_host(int server, struct sockaddr_in *sin,
host->h_version = version;
host->h_proto = proto;
host->h_rpcclnt = NULL;
init_MUTEX(&host->h_sema);
mutex_init(&host->h_mutex);
host->h_nextrebind = jiffies + NLM_HOST_REBIND;
host->h_expires = jiffies + NLM_HOST_EXPIRE;
atomic_set(&host->h_count, 1);
init_waitqueue_head(&host->h_gracewait);
init_rwsem(&host->h_rwsem);
host->h_state = 0; /* pseudo NSM state */
host->h_nsmstate = 0; /* real NSM state */
host->h_server = server;
Expand Down Expand Up @@ -172,7 +173,7 @@ nlm_bind_host(struct nlm_host *host)
(unsigned)ntohl(host->h_addr.sin_addr.s_addr));

/* Lock host handle */
down(&host->h_sema);
mutex_lock(&host->h_mutex);

/* If we've already created an RPC client, check whether
* RPC rebind is required
Expand Down Expand Up @@ -204,12 +205,12 @@ nlm_bind_host(struct nlm_host *host)
host->h_rpcclnt = clnt;
}

up(&host->h_sema);
mutex_unlock(&host->h_mutex);
return clnt;

forgetit:
printk("lockd: couldn't create RPC handle for %s\n", host->h_name);
up(&host->h_sema);
mutex_unlock(&host->h_mutex);
return NULL;
}

Expand Down
Loading

0 comments on commit 1d77062

Please sign in to comment.