cifs: add separate cred_uid field to sesInfo
[deliverable/linux.git] / fs / cifs / connect.c
index b2063ce113ec9e14e973b4b4ea8d0ab863388bfe..52a7646cc7af5419f8e95dd1e16e41ae2904b3bb 100644 (file)
@@ -67,6 +67,7 @@ struct smb_vol {
        char *iocharset;  /* local code page for mapping to and from Unicode */
        char source_rfc1001_name[16]; /* netbios name of client */
        char target_rfc1001_name[16]; /* netbios name of server for Win9x/ME */
+       uid_t cred_uid;
        uid_t linux_uid;
        gid_t linux_gid;
        mode_t file_mode;
@@ -98,6 +99,7 @@ struct smb_vol {
        bool noblocksnd:1;
        bool noautotune:1;
        bool nostrictsync:1; /* do not force expensive SMBflush on every sync */
+       bool fsc:1;     /* enable fscache */
        unsigned int rsize;
        unsigned int wsize;
        bool sockopt_tcp_nodelay:1;
@@ -831,7 +833,8 @@ cifs_parse_mount_options(char *options, const char *devname,
        /* null target name indicates to use *SMBSERVR default called name
           if we end up sending RFC1001 session initialize */
        vol->target_rfc1001_name[0] = 0;
-       vol->linux_uid = current_uid();  /* use current_euid() instead? */
+       vol->cred_uid = current_uid();
+       vol->linux_uid = current_uid();
        vol->linux_gid = current_gid();
 
        /* default to only allowing write access to owner of the mount */
@@ -843,6 +846,9 @@ cifs_parse_mount_options(char *options, const char *devname,
        /* default to using server inode numbers where available */
        vol->server_ino = 1;
 
+       /* XXX: default to fsc for testing until mount.cifs pieces are done */
+       vol->fsc = 1;
+
        if (!options)
                return 1;
 
@@ -1332,6 +1338,8 @@ cifs_parse_mount_options(char *options, const char *devname,
                        printk(KERN_WARNING "CIFS: Mount option noac not "
                                "supported. Instead set "
                                "/proc/fs/cifs/LookupCacheEnabled to 0\n");
+               } else if (strnicmp(data, "fsc", 3) == 0) {
+                       vol->fsc = true;
                } else
                        printk(KERN_WARNING "CIFS: Unknown mount option %s\n",
                                                data);
@@ -1652,7 +1660,7 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol)
        list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
                switch (server->secType) {
                case Kerberos:
-                       if (vol->linux_uid != ses->linux_uid)
+                       if (vol->cred_uid != ses->cred_uid)
                                continue;
                        break;
                default:
@@ -1769,6 +1777,7 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info)
                if (ses->domainName)
                        strcpy(ses->domainName, volume_info->domainname);
        }
+       ses->cred_uid = volume_info->cred_uid;
        ses->linux_uid = volume_info->linux_uid;
        ses->overrideSecFlg = volume_info->secFlg;
 
@@ -1837,6 +1846,7 @@ cifs_put_tcon(struct cifsTconInfo *tcon)
        _FreeXid(xid);
 
        tconInfoFree(tcon);
+       cifs_fscache_release_super_cookie(tcon);
        cifs_put_smb_ses(ses);
 }
 
@@ -1906,6 +1916,8 @@ cifs_get_tcon(struct cifsSesInfo *ses, struct smb_vol *volume_info)
        list_add(&tcon->tcon_list, &ses->tcon_list);
        write_unlock(&cifs_tcp_ses_lock);
 
+       cifs_fscache_get_super_cookie(tcon);
+
        return tcon;
 
 out_fail:
@@ -2460,6 +2472,8 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info,
                cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_GID;
        if (pvolume_info->dynperm)
                cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DYNPERM;
+       if (pvolume_info->fsc)
+               cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_FSCACHE;
        if (pvolume_info->direct_io) {
                cFYI(1, "mounting share using direct i/o");
                cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO;
This page took 0.027104 seconds and 5 git commands to generate.