Commit 5359cb24 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://cifs.bkbits.net/linux-2.5cifs

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 06a0e05b a6af37ef
Version 0.80
-----------
Fix oops on stopping oplock thread when removing cifs when
built as module.
Version 0.79
------------
Fix mount options for ro (readonly), uid, gid and file and directory mode.
Version 0.78
------------
Fix errors displayed on failed mounts to be more understandable.
Fixed various incorrect or misleading smb to posix error code mappings.
Version 0.77
------------
Fix display of NTFS DFS junctions to display as symlinks.
......
......@@ -432,7 +432,7 @@ static int
compare_oid(unsigned long *oid1, unsigned int oid1len,
unsigned long *oid2, unsigned int oid2len)
{
int i;
unsigned int i;
if (oid1len != oid2len)
return 0;
......
......@@ -24,5 +24,9 @@ struct cifs_sb_info {
struct nls_table *local_nls;
unsigned int rsize;
unsigned int wsize;
uid_t mnt_uid;
gid_t mnt_gid;
mode_t mnt_file_mode;
mode_t mnt_dir_mode;
};
#endif /* _CIFS_FS_SB_H */
......@@ -62,6 +62,9 @@ extern int cifs_umount(struct super_block *, struct cifs_sb_info *);
void cifs_proc_init(void);
void cifs_proc_clean(void);
static DECLARE_COMPLETION(cifs_oplock_exited);
static int
cifs_read_super(struct super_block *sb, void *data,
const char *devname, int silent)
......@@ -427,7 +430,8 @@ cifs_destroy_mids(void)
"cifs_destroy_mids: error not all structures were freed\n");
if (kmem_cache_destroy(cifs_oplock_cachep))
printk(KERN_WARNING
"error not all oplock structures were freed\n");}
"error not all oplock structures were freed\n");
}
static int cifs_oplock_thread(void * dummyarg)
{
......@@ -439,14 +443,13 @@ static int cifs_oplock_thread(void * dummyarg)
int rc;
daemonize("cifsoplockd");
allow_signal(SIGKILL);
allow_signal(SIGTERM);
oplockThread = current;
while (1) {
do {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(100*HZ);
/* BB add missing code */
cFYI(1,("oplock thread woken up - flush inode")); /* BB remove */
write_lock(&GlobalMid_Lock);
list_for_each_safe(tmp, tmp1, &GlobalOplock_Q) {
oplock_item = list_entry(tmp, struct oplock_q_entry,
......@@ -466,11 +469,10 @@ static int cifs_oplock_thread(void * dummyarg)
write_lock(&GlobalMid_Lock);
} else
break;
cFYI(1,("next time through list")); /* BB remove */
}
write_unlock(&GlobalMid_Lock);
cFYI(1,("next time through while loop")); /* BB remove */
}
} while(!signal_pending(current));
complete_and_exit (&cifs_oplock_exited, 0);
}
static int __init
......@@ -532,8 +534,10 @@ exit_cifs(void)
cifs_destroy_inodecache();
cifs_destroy_mids();
cifs_destroy_request_bufs();
if(oplockThread)
send_sig(SIGKILL, oplockThread, 1);
if(oplockThread) {
send_sig(SIGTERM, oplockThread, 1);
wait_for_completion(&cifs_oplock_exited);
}
}
MODULE_AUTHOR("Steve French <sfrench@us.ibm.com>");
......
......@@ -49,7 +49,7 @@ extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *,
extern int checkSMBhdr(struct smb_hdr *smb, __u16 mid);
extern int checkSMB(struct smb_hdr *smb, __u16 mid, int length);
extern int is_valid_oplock_break(struct smb_hdr *smb);
extern int smbCalcSize(struct smb_hdr *ptr);
extern unsigned int smbCalcSize(struct smb_hdr *ptr);
extern int decode_negTokenInit(unsigned char *security_blob, int length,
enum securityEnum *secType);
extern int map_smb_to_linux_error(struct smb_hdr *smb);
......
......@@ -53,7 +53,7 @@ struct smb_vol {
char *UNC;
char *UNCip;
uid_t linux_uid;
uid_t linux_gid;
gid_t linux_gid;
mode_t file_mode;
mode_t dir_mode;
int rw;
......@@ -136,8 +136,8 @@ cifs_reconnect(struct TCP_Server_Info *server)
int
cifs_demultiplex_thread(struct TCP_Server_Info *server)
{
int length, total_read;
unsigned int pdu_length;
int length;
unsigned int pdu_length, total_read;
struct smb_hdr *smb_buffer = NULL;
struct msghdr smb_msg;
mm_segment_t temp_fs;
......@@ -351,6 +351,10 @@ parse_mount_options(char *options, const char *devname, struct smb_vol *vol)
memset(vol,0,sizeof(struct smb_vol));
vol->linux_uid = current->uid; /* current->euid instead? */
vol->linux_gid = current->gid;
vol->dir_mode = S_IRWXUGO;
/* 2767 perms indicate mandatory locking support */
vol->file_mode = S_IALLUGO & ~(S_ISUID | S_IXGRP);
vol->rw = TRUE;
if (!options)
......@@ -466,6 +470,8 @@ parse_mount_options(char *options, const char *devname, struct smb_vol *vol)
/* ignore */
} else if (strnicmp(data, "rw", 2) == 0) {
vol->rw = TRUE;
} else if (strnicmp(data, "ro", 2) == 0) {
vol->rw = FALSE;
} else
printk(KERN_WARNING "CIFS: Unknown mount option %s\n",data);
}
......@@ -929,8 +935,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
cifs_sb->rsize = PAGE_CACHE_SIZE;
cERROR(1,("Attempt to set readsize for mount to less than one page (4096)"));
}
cifs_sb->mnt_uid = volume_info.linux_uid;
cifs_sb->mnt_gid = volume_info.linux_gid;
cifs_sb->mnt_file_mode = volume_info.file_mode;
cifs_sb->mnt_dir_mode = volume_info.dir_mode;
cFYI(1,("file mode: 0x%x dir mode: 0x%x",cifs_sb->mnt_file_mode,cifs_sb->mnt_dir_mode));
tcon =
find_unc(sin_server.sin_addr.s_addr, volume_info.UNC,
volume_info.username);
......
......@@ -123,8 +123,8 @@ cifs_open(struct inode *inode, struct file *file)
to problems creating new read-only files */
if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
CIFSSMBUnixSetPerms(xid, pTcon, full_path, inode->i_mode,
0xFFFFFFFFFFFFFFFF,
0xFFFFFFFFFFFFFFFF,
(__u64)-1,
(__u64)-1,
cifs_sb->local_nls);
else {/* BB implement via Windows security descriptors */
/* eg CIFSSMBWinSetPerms(xid,pTcon,full_path,mode,-1,-1,local_nls);*/
......@@ -351,8 +351,8 @@ cifs_write(struct file * file, const char *write_data,
size_t write_size, loff_t * poffset)
{
int rc = 0;
int bytes_written = 0;
int total_written;
unsigned int bytes_written = 0;
unsigned int total_written;
struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon;
int xid, long_op;
......@@ -633,9 +633,9 @@ cifs_read(struct file * file, char *read_data, size_t read_size,
loff_t * poffset)
{
int rc = -EACCES;
int bytes_read = 0;
int total_read;
int current_read_size;
unsigned int bytes_read = 0;
unsigned int total_read;
unsigned int current_read_size;
struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon;
int xid;
......@@ -742,13 +742,13 @@ cifs_readpages(struct file *file, struct address_space *mapping,
struct list_head *page_list, unsigned num_pages)
{
int rc = -EACCES;
int xid,i;
int xid;
loff_t offset;
struct page * page;
struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon;
int bytes_read = 0;
unsigned int read_size;
unsigned int read_size,i;
char * smb_read_data = 0;
struct smb_com_read_rsp * pSMBr;
struct pagevec lru_pvec;
......@@ -877,6 +877,8 @@ fill_in_inode(struct inode *tmp_inode,
FILE_DIRECTORY_INFO * pfindData, int *pobject_type)
{
struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(tmp_inode->i_sb);
pfindData->ExtFileAttributes =
le32_to_cpu(pfindData->ExtFileAttributes);
pfindData->AllocationSize = le64_to_cpu(pfindData->AllocationSize);
......@@ -894,7 +896,13 @@ fill_in_inode(struct inode *tmp_inode,
cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime));
/* treat dos attribute of read-only as read-only mode bit e.g. 555? */
/* 2767 perms - indicate mandatory locking */
tmp_inode->i_mode = S_IALLUGO & ~(S_ISUID | S_IXGRP);
/* BB fill in uid and gid here? with help from winbind?
or retrieve from NTFS stream extended attribute */
tmp_inode->i_uid = cifs_sb->mnt_uid;
tmp_inode->i_gid = cifs_sb->mnt_gid;
/* set default mode. will override for dirs below */
tmp_inode->i_mode = cifs_sb->mnt_file_mode;
cFYI(0,
("CIFS FFIRST: Attributes came in as 0x%x",
pfindData->ExtFileAttributes));
......@@ -905,7 +913,7 @@ fill_in_inode(struct inode *tmp_inode,
} else if (pfindData->ExtFileAttributes & ATTR_DIRECTORY) {
*pobject_type = DT_DIR;
/* override default perms since we do not lock dirs */
tmp_inode->i_mode = S_IRWXUGO;
tmp_inode->i_mode = cifs_sb->mnt_dir_mode;
tmp_inode->i_mode |= S_IFDIR;
} else {
*pobject_type = DT_REG;
......@@ -1091,10 +1099,10 @@ int
cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
{
int rc = 0;
int xid, i;
int xid;
int Unicode = FALSE;
int UnixSearch = FALSE;
unsigned int bufsize;
unsigned int bufsize, i;
__u16 searchHandle;
struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon;
......
......@@ -224,16 +224,19 @@ cifs_get_inode_info(struct inode **pinode,
cifs_NTtimeToUnix(le64_to_cpu(findData.LastWriteTime));
inode->i_ctime =
cifs_NTtimeToUnix(le64_to_cpu(findData.ChangeTime));
inode->i_mode = S_IALLUGO & ~(S_ISUID | S_IXGRP); /* 2767 perms indicate mandatory locking - will override for dirs later */
cFYI(0,
(" Attributes came in as 0x%x ", findData.Attributes));
if (findData.Attributes & ATTR_REPARSE) {
/* Can IFLNK be set as it basically is on windows with IFREG or IFDIR? */
/* set default mode. will override for dirs below */
inode->i_mode = cifs_sb->mnt_file_mode;
if (findData.Attributes & ATTR_REPARSE) {
/* Can IFLNK be set as it basically is on windows with IFREG or IFDIR? */
inode->i_mode |= S_IFLNK;
} else if (findData.Attributes & ATTR_DIRECTORY) {
/* override default perms since we do not do byte range locking on dirs */
inode->i_mode = S_IRWXUGO;
inode->i_mode |= S_IFDIR;
/* override default perms since we do not do byte range locking on dirs */
inode->i_mode = cifs_sb->mnt_dir_mode;
inode->i_mode |= S_IFDIR;
} else {
inode->i_mode |= S_IFREG;
/* treat the dos attribute of read-only as read-only mode e.g. 555 */
......@@ -250,8 +253,11 @@ cifs_get_inode_info(struct inode **pinode,
(unsigned long) inode->i_size, inode->i_blocks));
inode->i_nlink = le32_to_cpu(findData.NumberOfLinks);
/* BB fill in uid and gid here? with help from winbind? */
/* BB fill in uid and gid here? with help from winbind?
or retrieve from NTFS stream extended attribute */
inode->i_uid = cifs_sb->mnt_uid;
inode->i_gid = cifs_sb->mnt_gid;
if (S_ISREG(inode->i_mode)) {
cFYI(1, (" File inode "));
inode->i_op = &cifs_file_inode_ops;
......@@ -389,8 +395,8 @@ cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
direntry->d_inode->i_nlink = 2;
if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
0xFFFFFFFFFFFFFFFF,
0xFFFFFFFFFFFFFFFF,
(__u64)-1,
(__u64)-1,
cifs_sb->local_nls);
else { /* BB to be implemented via Windows secrty descriptors*/
/* eg CIFSSMBWinSetPerms(xid,pTcon,full_path,mode,-1,-1,local_nls);*/
......
......@@ -274,12 +274,12 @@ checkSMB(struct smb_hdr *smb, __u16 mid, int length)
cFYI(0,
("Entering checkSMB with Length: %x, smb_buf_length: %x ",
length, ntohl(smb->smb_buf_length)));
if ((length < 2 + sizeof (struct smb_hdr))
if (((unsigned int)length < 2 + sizeof (struct smb_hdr))
|| (4 + ntohl(smb->smb_buf_length) >
CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE)) {
if (length < 2 + sizeof (struct smb_hdr)) {
if ((unsigned int)length < 2 + sizeof (struct smb_hdr)) {
cERROR(1, ("Length less than 2 + sizeof smb_hdr "));
if ((length >= sizeof (struct smb_hdr) - 1)
if (((unsigned int)length >= sizeof (struct smb_hdr) - 1)
&& (smb->Status.CifsError != 0))
return 0; /* some error cases do not return wct and bcc */
......@@ -298,7 +298,7 @@ checkSMB(struct smb_hdr *smb, __u16 mid, int length)
return 1;
if ((4 + ntohl(smb->smb_buf_length) != smbCalcSize(smb))
|| (4 + ntohl(smb->smb_buf_length) != length)) {
|| (4 + ntohl(smb->smb_buf_length) != (unsigned int)length)) {
return 0;
} else {
cERROR(1, ("smbCalcSize %x ", smbCalcSize(smb)));
......
......@@ -791,7 +791,7 @@ ntstatus_to_dos(__u32 ntstatus, __u8 * eclass, __u16 * ecode)
int
map_smb_to_linux_error(struct smb_hdr *smb)
{
int i;
unsigned int i;
int rc = -EIO; /* if transport error smb error may not be set */
__u8 smberrclass;
__u16 smberrcode;
......@@ -859,10 +859,10 @@ map_smb_to_linux_error(struct smb_hdr *smb)
* calculate the size of the SMB message based on the fixed header
* portion, the number of word parameters and the data portion of the message
*/
int
unsigned int
smbCalcSize(struct smb_hdr *ptr)
{
return (sizeof (struct smb_hdr) + (int) (2 * ptr->WordCount) +
return (sizeof (struct smb_hdr) + (2 * ptr->WordCount) +
BCC(ptr));
}
......
......@@ -186,7 +186,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
int *pbytes_returned, const int long_op)
{
int rc = 0;
int receive_len;
unsigned int receive_len;
long timeout;
struct mid_q_entry *midQ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment