]> Pileus Git - ~andy/linux/blobdiff - fs/cifs/file.c
cifs: set MAY_SIGN when sec=krb5
[~andy/linux] / fs / cifs / file.c
index a8d8b589ee0efa6820627187098f89838a87e2cb..8c0d8557731443ffb564905bb1ad0a9c64b8169b 100644 (file)
@@ -43,6 +43,7 @@
 #include "cifs_fs_sb.h"
 #include "fscache.h"
 
+
 static inline int cifs_convert_flags(unsigned int flags)
 {
        if ((flags & O_ACCMODE) == O_RDONLY)
@@ -72,10 +73,15 @@ static u32 cifs_posix_convert_flags(unsigned int flags)
        else if ((flags & O_ACCMODE) == O_RDWR)
                posix_flags = SMB_O_RDWR;
 
-       if (flags & O_CREAT)
+       if (flags & O_CREAT) {
                posix_flags |= SMB_O_CREAT;
-       if (flags & O_EXCL)
-               posix_flags |= SMB_O_EXCL;
+               if (flags & O_EXCL)
+                       posix_flags |= SMB_O_EXCL;
+       } else if (flags & O_EXCL)
+               cFYI(1, "Application %s pid %d has incorrectly set O_EXCL flag"
+                       "but not O_CREAT on file open. Ignoring O_EXCL",
+                       current->comm, current->tgid);
+
        if (flags & O_TRUNC)
                posix_flags |= SMB_O_TRUNC;
        /* be safe and imply O_SYNC for O_DSYNC */
@@ -947,7 +953,7 @@ static int
 cifs_posix_lock_test(struct file *file, struct file_lock *flock)
 {
        int rc = 0;
-       struct cifsInodeInfo *cinode = CIFS_I(file->f_path.dentry->d_inode);
+       struct cifsInodeInfo *cinode = CIFS_I(file_inode(file));
        unsigned char saved_type = flock->fl_type;
 
        if ((flock->fl_flags & FL_POSIX) == 0)
@@ -974,7 +980,7 @@ cifs_posix_lock_test(struct file *file, struct file_lock *flock)
 static int
 cifs_posix_lock_set(struct file *file, struct file_lock *flock)
 {
-       struct cifsInodeInfo *cinode = CIFS_I(file->f_path.dentry->d_inode);
+       struct cifsInodeInfo *cinode = CIFS_I(file_inode(file));
        int rc = 1;
 
        if ((flock->fl_flags & FL_POSIX) == 0)
@@ -1548,7 +1554,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *flock)
 
        cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
        netfid = cfile->fid.netfid;
-       cinode = CIFS_I(file->f_path.dentry->d_inode);
+       cinode = CIFS_I(file_inode(file));
 
        if (cap_unix(tcon->ses) &&
            (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) &&
@@ -2171,7 +2177,7 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end,
        struct cifs_tcon *tcon;
        struct TCP_Server_Info *server;
        struct cifsFileInfo *smbfile = file->private_data;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
 
        rc = filemap_write_and_wait_range(inode->i_mapping, start, end);
@@ -2246,7 +2252,7 @@ int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
  */
 int cifs_flush(struct file *file, fl_owner_t id)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        int rc = 0;
 
        if (file->f_mode & FMODE_WRITE)
@@ -2480,7 +2486,7 @@ ssize_t cifs_user_writev(struct kiocb *iocb, const struct iovec *iov,
        ssize_t written;
        struct inode *inode;
 
-       inode = iocb->ki_filp->f_path.dentry->d_inode;
+       inode = file_inode(iocb->ki_filp);
 
        /*
         * BB - optimize the way when signing is disabled. We can drop this
@@ -2543,7 +2549,7 @@ ssize_t
 cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov,
                   unsigned long nr_segs, loff_t pos)
 {
-       struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(iocb->ki_filp);
        struct cifsInodeInfo *cinode = CIFS_I(inode);
        struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
        struct cifsFileInfo *cfile = (struct cifsFileInfo *)
@@ -2915,7 +2921,7 @@ ssize_t
 cifs_strict_readv(struct kiocb *iocb, const struct iovec *iov,
                  unsigned long nr_segs, loff_t pos)
 {
-       struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(iocb->ki_filp);
        struct cifsInodeInfo *cinode = CIFS_I(inode);
        struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
        struct cifsFileInfo *cfile = (struct cifsFileInfo *)
@@ -3063,7 +3069,7 @@ static struct vm_operations_struct cifs_file_vm_ops = {
 int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma)
 {
        int rc, xid;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
 
        xid = get_xid();
 
@@ -3356,7 +3362,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
        int rc;
 
        /* Is the page cached? */
-       rc = cifs_readpage_from_fscache(file->f_path.dentry->d_inode, page);
+       rc = cifs_readpage_from_fscache(file_inode(file), page);
        if (rc == 0)
                goto read_complete;
 
@@ -3371,8 +3377,8 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
        else
                cFYI(1, "Bytes read %d", rc);
 
-       file->f_path.dentry->d_inode->i_atime =
-               current_fs_time(file->f_path.dentry->d_inode->i_sb);
+       file_inode(file)->i_atime =
+               current_fs_time(file_inode(file)->i_sb);
 
        if (PAGE_CACHE_SIZE > rc)
                memset(read_data + rc, 0, PAGE_CACHE_SIZE - rc);
@@ -3381,7 +3387,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
        SetPageUptodate(page);
 
        /* send this page to the cache */
-       cifs_readpage_to_fscache(file->f_path.dentry->d_inode, page);
+       cifs_readpage_to_fscache(file_inode(file), page);
 
        rc = 0;