pid: tighten pidmap spinlock critical section by removing kfree()
[safe/jmp/linux-2.6] / fs / smbfs / proc.c
index d6baec0..71c29b6 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
 #include <linux/fs.h>
@@ -15,7 +16,6 @@
 #include <linux/stat.h>
 #include <linux/fcntl.h>
 #include <linux/dcache.h>
-#include <linux/dirent.h>
 #include <linux/nls.h>
 #include <linux/smp_lock.h>
 #include <linux/net.h>
@@ -509,7 +509,7 @@ date_unix2dos(struct smb_sb_info *server,
                month = 2;
        } else {
                nl_day = (year & 3) || day <= 59 ? day : day - 1;
-               for (month = 0; month < 12; month++)
+               for (month = 1; month < 12; month++)
                        if (day_n[month] > nl_day)
                                break;
        }
@@ -864,7 +864,7 @@ smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt)
                goto out;
 
        error = -EACCES;
-       if (current->uid != server->mnt->mounted_uid && 
+       if (current_uid() != server->mnt->mounted_uid &&
            !capable(CAP_SYS_ADMIN))
                goto out;
 
@@ -872,11 +872,11 @@ smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt)
        filp = fget(opt->fd);
        if (!filp)
                goto out;
-       if (!smb_valid_socket(filp->f_dentry->d_inode))
+       if (!smb_valid_socket(filp->f_path.dentry->d_inode))
                goto out_putf;
 
        server->sock_file = filp;
-       server->conn_pid = current->pid;
+       server->conn_pid = get_pid(task_pid(current));
        server->opt = *opt;
        server->generation += 1;
        server->state = CONN_VALID;
@@ -897,7 +897,7 @@ smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt)
        /*
         * Store the server in sock user_data (Only used by sunrpc)
         */
-       sk = SOCKET_I(filp->f_dentry->d_inode)->sk;
+       sk = SOCKET_I(filp->f_path.dentry->d_inode)->sk;
        sk->sk_user_data = server;
 
        /* chain into the data_ready callback */
@@ -970,8 +970,8 @@ smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt)
        }
 
        VERBOSE("protocol=%d, max_xmit=%d, pid=%d capabilities=0x%x\n",
-               server->opt.protocol, server->opt.max_xmit, server->conn_pid,
-               server->opt.capabilities);
+               server->opt.protocol, server->opt.max_xmit,
+               pid_nr(server->conn_pid), server->opt.capabilities);
 
        /* FIXME: this really should be done by smbmount. */
        if (server->opt.max_xmit > SMB_MAX_PACKET_SIZE) {
@@ -1825,7 +1825,6 @@ smb_init_dirent(struct smb_sb_info *server, struct smb_fattr *fattr)
        fattr->f_nlink = 1;
        fattr->f_uid = server->mnt->uid;
        fattr->f_gid = server->mnt->gid;
-       fattr->f_blksize = SMB_ST_BLKSIZE;
        fattr->f_unix = 0;
 }
 
@@ -1939,7 +1938,7 @@ static int
 smb_proc_readdir_short(struct file *filp, void *dirent, filldir_t filldir,
                       struct smb_cache_control *ctl)
 {
-       struct dentry *dir = filp->f_dentry;
+       struct dentry *dir = filp->f_path.dentry;
        struct smb_sb_info *server = server_from_dentry(dir);
        struct qstr qname;
        struct smb_fattr fattr;
@@ -2291,7 +2290,7 @@ static int
 smb_proc_readdir_long(struct file *filp, void *dirent, filldir_t filldir,
                      struct smb_cache_control *ctl)
 {
-       struct dentry *dir = filp->f_dentry;
+       struct dentry *dir = filp->f_path.dentry;
        struct smb_sb_info *server = server_from_dentry(dir);
        struct qstr qname;
        struct smb_fattr fattr;
@@ -2593,7 +2592,7 @@ smb_proc_getattr_ff(struct smb_sb_info *server, struct dentry *dentry,
        fattr->f_mtime.tv_sec = date_dos2unix(server, date, time);
        fattr->f_mtime.tv_nsec = 0;
        VERBOSE("name=%s, date=%x, time=%x, mtime=%ld\n",
-               mask, date, time, fattr->f_mtime);
+               mask, date, time, fattr->f_mtime.tv_sec);
        fattr->f_size = DVAL(req->rq_data, 12);
        /* ULONG allocation size */
        fattr->attr = WVAL(req->rq_data, 20);
@@ -2859,7 +2858,7 @@ static int
 smb_proc_readdir_null(struct file *filp, void *dirent, filldir_t filldir,
                      struct smb_cache_control *ctl)
 {
-       struct smb_sb_info *server = server_from_dentry(filp->f_dentry);
+       struct smb_sb_info *server = server_from_dentry(filp->f_path.dentry);
 
        if (smb_proc_ops_wait(server) < 0)
                return -EIO;
@@ -3225,9 +3224,9 @@ smb_proc_settime(struct dentry *dentry, struct smb_fattr *fattr)
 }
 
 int
-smb_proc_dskattr(struct super_block *sb, struct kstatfs *attr)
+smb_proc_dskattr(struct dentry *dentry, struct kstatfs *attr)
 {
-       struct smb_sb_info *server = SMB_SB(sb);
+       struct smb_sb_info *server = SMB_SB(dentry->d_sb);
        int result;
        char *p;
        long unit;