diff options
-rw-r--r-- | fs/cifs/cifspdu.h | 1 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 16 | ||||
-rw-r--r-- | fs/cifs/connect.c | 79 | ||||
-rw-r--r-- | fs/cifs/dir.c | 16 | ||||
-rw-r--r-- | fs/cifs/inode.c | 35 |
5 files changed, 81 insertions, 66 deletions
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index a0d26b540d4e..c43bf4b7a556 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -340,6 +340,7 @@ | |||
340 | #define OPEN_NO_RECALL 0x00400000 | 340 | #define OPEN_NO_RECALL 0x00400000 |
341 | #define OPEN_FREE_SPACE_QUERY 0x00800000 /* should be zero */ | 341 | #define OPEN_FREE_SPACE_QUERY 0x00800000 /* should be zero */ |
342 | #define CREATE_OPTIONS_MASK 0x007FFFFF | 342 | #define CREATE_OPTIONS_MASK 0x007FFFFF |
343 | #define CREATE_OPTION_READONLY 0x10000000 | ||
343 | #define CREATE_OPTION_SPECIAL 0x20000000 /* system. NB not sent over wire */ | 344 | #define CREATE_OPTION_SPECIAL 0x20000000 /* system. NB not sent over wire */ |
344 | 345 | ||
345 | /* ImpersonationLevel flags */ | 346 | /* ImpersonationLevel flags */ |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index cfd9750852b3..95fbba4ea7d4 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -1224,11 +1224,8 @@ OldOpenRetry: | |||
1224 | else /* BB FIXME BB */ | 1224 | else /* BB FIXME BB */ |
1225 | pSMB->FileAttributes = cpu_to_le16(0/*ATTR_NORMAL*/); | 1225 | pSMB->FileAttributes = cpu_to_le16(0/*ATTR_NORMAL*/); |
1226 | 1226 | ||
1227 | /* if ((omode & S_IWUGO) == 0) | 1227 | if (create_options & CREATE_OPTION_READONLY) |
1228 | pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY);*/ | 1228 | pSMB->FileAttributes |= cpu_to_le16(ATTR_READONLY); |
1229 | /* Above line causes problems due to vfs splitting create into two | ||
1230 | pieces - need to set mode after file created not while it is | ||
1231 | being created */ | ||
1232 | 1229 | ||
1233 | /* BB FIXME BB */ | 1230 | /* BB FIXME BB */ |
1234 | /* pSMB->CreateOptions = cpu_to_le32(create_options & | 1231 | /* pSMB->CreateOptions = cpu_to_le32(create_options & |
@@ -1331,17 +1328,16 @@ openRetry: | |||
1331 | pSMB->FileAttributes = cpu_to_le32(ATTR_SYSTEM); | 1328 | pSMB->FileAttributes = cpu_to_le32(ATTR_SYSTEM); |
1332 | else | 1329 | else |
1333 | pSMB->FileAttributes = cpu_to_le32(ATTR_NORMAL); | 1330 | pSMB->FileAttributes = cpu_to_le32(ATTR_NORMAL); |
1331 | |||
1334 | /* XP does not handle ATTR_POSIX_SEMANTICS */ | 1332 | /* XP does not handle ATTR_POSIX_SEMANTICS */ |
1335 | /* but it helps speed up case sensitive checks for other | 1333 | /* but it helps speed up case sensitive checks for other |
1336 | servers such as Samba */ | 1334 | servers such as Samba */ |
1337 | if (tcon->ses->capabilities & CAP_UNIX) | 1335 | if (tcon->ses->capabilities & CAP_UNIX) |
1338 | pSMB->FileAttributes |= cpu_to_le32(ATTR_POSIX_SEMANTICS); | 1336 | pSMB->FileAttributes |= cpu_to_le32(ATTR_POSIX_SEMANTICS); |
1339 | 1337 | ||
1340 | /* if ((omode & S_IWUGO) == 0) | 1338 | if (create_options & CREATE_OPTION_READONLY) |
1341 | pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY);*/ | 1339 | pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY); |
1342 | /* Above line causes problems due to vfs splitting create into two | 1340 | |
1343 | pieces - need to set mode after file created not while it is | ||
1344 | being created */ | ||
1345 | pSMB->ShareAccess = cpu_to_le32(FILE_SHARE_ALL); | 1341 | pSMB->ShareAccess = cpu_to_le32(FILE_SHARE_ALL); |
1346 | pSMB->CreateDisposition = cpu_to_le32(openDisposition); | 1342 | pSMB->CreateDisposition = cpu_to_le32(openDisposition); |
1347 | pSMB->CreateOptions = cpu_to_le32(create_options & CREATE_OPTIONS_MASK); | 1343 | pSMB->CreateOptions = cpu_to_le32(create_options & CREATE_OPTIONS_MASK); |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 791ca5c1a116..f428bf3bf1a9 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -348,7 +348,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
348 | int reconnect; | 348 | int reconnect; |
349 | 349 | ||
350 | current->flags |= PF_MEMALLOC; | 350 | current->flags |= PF_MEMALLOC; |
351 | server->tsk = current; /* save process info to wake at shutdown */ | ||
352 | cFYI(1, ("Demultiplex PID: %d", task_pid_nr(current))); | 351 | cFYI(1, ("Demultiplex PID: %d", task_pid_nr(current))); |
353 | write_lock(&GlobalSMBSeslock); | 352 | write_lock(&GlobalSMBSeslock); |
354 | atomic_inc(&tcpSesAllocCount); | 353 | atomic_inc(&tcpSesAllocCount); |
@@ -651,10 +650,20 @@ multi_t2_fnd: | |||
651 | 650 | ||
652 | spin_lock(&GlobalMid_Lock); | 651 | spin_lock(&GlobalMid_Lock); |
653 | server->tcpStatus = CifsExiting; | 652 | server->tcpStatus = CifsExiting; |
654 | server->tsk = NULL; | 653 | spin_unlock(&GlobalMid_Lock); |
654 | |||
655 | /* don't exit until kthread_stop is called */ | ||
656 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
657 | while (!kthread_should_stop()) { | ||
658 | schedule(); | ||
659 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
660 | } | ||
661 | set_current_state(TASK_RUNNING); | ||
662 | |||
655 | /* check if we have blocked requests that need to free */ | 663 | /* check if we have blocked requests that need to free */ |
656 | /* Note that cifs_max_pending is normally 50, but | 664 | /* Note that cifs_max_pending is normally 50, but |
657 | can be set at module install time to as little as two */ | 665 | can be set at module install time to as little as two */ |
666 | spin_lock(&GlobalMid_Lock); | ||
658 | if (atomic_read(&server->inFlight) >= cifs_max_pending) | 667 | if (atomic_read(&server->inFlight) >= cifs_max_pending) |
659 | atomic_set(&server->inFlight, cifs_max_pending - 1); | 668 | atomic_set(&server->inFlight, cifs_max_pending - 1); |
660 | /* We do not want to set the max_pending too low or we | 669 | /* We do not want to set the max_pending too low or we |
@@ -1318,42 +1327,43 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1318 | 1327 | ||
1319 | static struct cifsSesInfo * | 1328 | static struct cifsSesInfo * |
1320 | cifs_find_tcp_session(struct in_addr *target_ip_addr, | 1329 | cifs_find_tcp_session(struct in_addr *target_ip_addr, |
1321 | struct in6_addr *target_ip6_addr, | 1330 | struct in6_addr *target_ip6_addr, |
1322 | char *userName, struct TCP_Server_Info **psrvTcp) | 1331 | char *userName, struct TCP_Server_Info **psrvTcp) |
1323 | { | 1332 | { |
1324 | struct list_head *tmp; | 1333 | struct list_head *tmp; |
1325 | struct cifsSesInfo *ses; | 1334 | struct cifsSesInfo *ses; |
1335 | |||
1326 | *psrvTcp = NULL; | 1336 | *psrvTcp = NULL; |
1327 | read_lock(&GlobalSMBSeslock); | ||
1328 | 1337 | ||
1338 | read_lock(&GlobalSMBSeslock); | ||
1329 | list_for_each(tmp, &GlobalSMBSessionList) { | 1339 | list_for_each(tmp, &GlobalSMBSessionList) { |
1330 | ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList); | 1340 | ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList); |
1331 | if (ses->server) { | 1341 | if (!ses->server) |
1332 | if ((target_ip_addr && | 1342 | continue; |
1333 | (ses->server->addr.sockAddr.sin_addr.s_addr | 1343 | |
1334 | == target_ip_addr->s_addr)) || (target_ip6_addr | 1344 | if (target_ip_addr && |
1335 | && memcmp(&ses->server->addr.sockAddr6.sin6_addr, | 1345 | ses->server->addr.sockAddr.sin_addr.s_addr != target_ip_addr->s_addr) |
1336 | target_ip6_addr, sizeof(*target_ip6_addr)))) { | 1346 | continue; |
1337 | /* BB lock server and tcp session and increment | 1347 | else if (target_ip6_addr && |
1338 | use count here?? */ | 1348 | memcmp(&ses->server->addr.sockAddr6.sin6_addr, |
1339 | 1349 | target_ip6_addr, sizeof(*target_ip6_addr))) | |
1340 | /* found a match on the TCP session */ | 1350 | continue; |
1341 | *psrvTcp = ses->server; | 1351 | /* BB lock server and tcp session; increment use count here?? */ |
1342 | 1352 | ||
1343 | /* BB check if reconnection needed */ | 1353 | /* found a match on the TCP session */ |
1344 | if (strncmp | 1354 | *psrvTcp = ses->server; |
1345 | (ses->userName, userName, | 1355 | |
1346 | MAX_USERNAME_SIZE) == 0){ | 1356 | /* BB check if reconnection needed */ |
1347 | read_unlock(&GlobalSMBSeslock); | 1357 | if (strncmp(ses->userName, userName, MAX_USERNAME_SIZE) == 0) { |
1348 | /* Found exact match on both TCP and | 1358 | read_unlock(&GlobalSMBSeslock); |
1349 | SMB sessions */ | 1359 | /* Found exact match on both TCP and |
1350 | return ses; | 1360 | SMB sessions */ |
1351 | } | 1361 | return ses; |
1352 | } | ||
1353 | } | 1362 | } |
1354 | /* else tcp and smb sessions need reconnection */ | 1363 | /* else tcp and smb sessions need reconnection */ |
1355 | } | 1364 | } |
1356 | read_unlock(&GlobalSMBSeslock); | 1365 | read_unlock(&GlobalSMBSeslock); |
1366 | |||
1357 | return NULL; | 1367 | return NULL; |
1358 | } | 1368 | } |
1359 | 1369 | ||
@@ -2186,15 +2196,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2186 | srvTcp->tcpStatus = CifsExiting; | 2196 | srvTcp->tcpStatus = CifsExiting; |
2187 | spin_unlock(&GlobalMid_Lock); | 2197 | spin_unlock(&GlobalMid_Lock); |
2188 | if (srvTcp->tsk) { | 2198 | if (srvTcp->tsk) { |
2189 | struct task_struct *tsk; | ||
2190 | /* If we could verify that kthread_stop would | 2199 | /* If we could verify that kthread_stop would |
2191 | always wake up processes blocked in | 2200 | always wake up processes blocked in |
2192 | tcp in recv_mesg then we could remove the | 2201 | tcp in recv_mesg then we could remove the |
2193 | send_sig call */ | 2202 | send_sig call */ |
2194 | force_sig(SIGKILL, srvTcp->tsk); | 2203 | force_sig(SIGKILL, srvTcp->tsk); |
2195 | tsk = srvTcp->tsk; | 2204 | kthread_stop(srvTcp->tsk); |
2196 | if (tsk) | ||
2197 | kthread_stop(tsk); | ||
2198 | } | 2205 | } |
2199 | } | 2206 | } |
2200 | /* If find_unc succeeded then rc == 0 so we can not end */ | 2207 | /* If find_unc succeeded then rc == 0 so we can not end */ |
@@ -2210,23 +2217,17 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2210 | if ((temp_rc == -ESHUTDOWN) && | 2217 | if ((temp_rc == -ESHUTDOWN) && |
2211 | (pSesInfo->server) && | 2218 | (pSesInfo->server) && |
2212 | (pSesInfo->server->tsk)) { | 2219 | (pSesInfo->server->tsk)) { |
2213 | struct task_struct *tsk; | ||
2214 | force_sig(SIGKILL, | 2220 | force_sig(SIGKILL, |
2215 | pSesInfo->server->tsk); | 2221 | pSesInfo->server->tsk); |
2216 | tsk = pSesInfo->server->tsk; | 2222 | kthread_stop(pSesInfo->server->tsk); |
2217 | if (tsk) | ||
2218 | kthread_stop(tsk); | ||
2219 | } | 2223 | } |
2220 | } else { | 2224 | } else { |
2221 | cFYI(1, ("No session or bad tcon")); | 2225 | cFYI(1, ("No session or bad tcon")); |
2222 | if ((pSesInfo->server) && | 2226 | if ((pSesInfo->server) && |
2223 | (pSesInfo->server->tsk)) { | 2227 | (pSesInfo->server->tsk)) { |
2224 | struct task_struct *tsk; | ||
2225 | force_sig(SIGKILL, | 2228 | force_sig(SIGKILL, |
2226 | pSesInfo->server->tsk); | 2229 | pSesInfo->server->tsk); |
2227 | tsk = pSesInfo->server->tsk; | 2230 | kthread_stop(pSesInfo->server->tsk); |
2228 | if (tsk) | ||
2229 | kthread_stop(tsk); | ||
2230 | } | 2231 | } |
2231 | } | 2232 | } |
2232 | sesInfoFree(pSesInfo); | 2233 | sesInfoFree(pSesInfo); |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 6ed775986be9..e4e0078a0526 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -119,6 +119,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
119 | { | 119 | { |
120 | int rc = -ENOENT; | 120 | int rc = -ENOENT; |
121 | int xid; | 121 | int xid; |
122 | int create_options = CREATE_NOT_DIR; | ||
122 | int oplock = 0; | 123 | int oplock = 0; |
123 | int desiredAccess = GENERIC_READ | GENERIC_WRITE; | 124 | int desiredAccess = GENERIC_READ | GENERIC_WRITE; |
124 | __u16 fileHandle; | 125 | __u16 fileHandle; |
@@ -176,9 +177,19 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
176 | FreeXid(xid); | 177 | FreeXid(xid); |
177 | return -ENOMEM; | 178 | return -ENOMEM; |
178 | } | 179 | } |
180 | |||
181 | mode &= ~current->fs->umask; | ||
182 | |||
183 | /* | ||
184 | * if we're not using unix extensions, see if we need to set | ||
185 | * ATTR_READONLY on the create call | ||
186 | */ | ||
187 | if (!pTcon->unix_ext && (mode & S_IWUGO) == 0) | ||
188 | create_options |= CREATE_OPTION_READONLY; | ||
189 | |||
179 | if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS) | 190 | if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS) |
180 | rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, | 191 | rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, |
181 | desiredAccess, CREATE_NOT_DIR, | 192 | desiredAccess, create_options, |
182 | &fileHandle, &oplock, buf, cifs_sb->local_nls, | 193 | &fileHandle, &oplock, buf, cifs_sb->local_nls, |
183 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | 194 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); |
184 | else | 195 | else |
@@ -187,7 +198,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
187 | if (rc == -EIO) { | 198 | if (rc == -EIO) { |
188 | /* old server, retry the open legacy style */ | 199 | /* old server, retry the open legacy style */ |
189 | rc = SMBLegacyOpen(xid, pTcon, full_path, disposition, | 200 | rc = SMBLegacyOpen(xid, pTcon, full_path, disposition, |
190 | desiredAccess, CREATE_NOT_DIR, | 201 | desiredAccess, create_options, |
191 | &fileHandle, &oplock, buf, cifs_sb->local_nls, | 202 | &fileHandle, &oplock, buf, cifs_sb->local_nls, |
192 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | 203 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); |
193 | } | 204 | } |
@@ -197,7 +208,6 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
197 | /* If Open reported that we actually created a file | 208 | /* If Open reported that we actually created a file |
198 | then we now have to set the mode if possible */ | 209 | then we now have to set the mode if possible */ |
199 | if ((pTcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) { | 210 | if ((pTcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) { |
200 | mode &= ~current->fs->umask; | ||
201 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { | 211 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { |
202 | CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, | 212 | CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, |
203 | (__u64)current->fsuid, | 213 | (__u64)current->fsuid, |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 0d9d2e6d7af6..fcbdbb6ad7bf 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -974,8 +974,8 @@ mkdir_get_info: | |||
974 | * failed to get it from the server or was set bogus */ | 974 | * failed to get it from the server or was set bogus */ |
975 | if ((direntry->d_inode) && (direntry->d_inode->i_nlink < 2)) | 975 | if ((direntry->d_inode) && (direntry->d_inode->i_nlink < 2)) |
976 | direntry->d_inode->i_nlink = 2; | 976 | direntry->d_inode->i_nlink = 2; |
977 | mode &= ~current->fs->umask; | ||
977 | if (pTcon->unix_ext) { | 978 | if (pTcon->unix_ext) { |
978 | mode &= ~current->fs->umask; | ||
979 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { | 979 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { |
980 | CIFSSMBUnixSetPerms(xid, pTcon, full_path, | 980 | CIFSSMBUnixSetPerms(xid, pTcon, full_path, |
981 | mode, | 981 | mode, |
@@ -994,9 +994,16 @@ mkdir_get_info: | |||
994 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 994 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
995 | } | 995 | } |
996 | } else { | 996 | } else { |
997 | /* BB to be implemented via Windows secrty descriptors | 997 | if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) && |
998 | eg CIFSSMBWinSetPerms(xid, pTcon, full_path, mode, | 998 | (mode & S_IWUGO) == 0) { |
999 | -1, -1, local_nls); */ | 999 | FILE_BASIC_INFO pInfo; |
1000 | memset(&pInfo, 0, sizeof(pInfo)); | ||
1001 | pInfo.Attributes = cpu_to_le32(ATTR_READONLY); | ||
1002 | CIFSSMBSetTimes(xid, pTcon, full_path, | ||
1003 | &pInfo, cifs_sb->local_nls, | ||
1004 | cifs_sb->mnt_cifs_flags & | ||
1005 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
1006 | } | ||
1000 | if (direntry->d_inode) { | 1007 | if (direntry->d_inode) { |
1001 | direntry->d_inode->i_mode = mode; | 1008 | direntry->d_inode->i_mode = mode; |
1002 | direntry->d_inode->i_mode |= S_IFDIR; | 1009 | direntry->d_inode->i_mode |= S_IFDIR; |
@@ -1408,18 +1415,19 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1408 | __u64 uid = 0xFFFFFFFFFFFFFFFFULL; | 1415 | __u64 uid = 0xFFFFFFFFFFFFFFFFULL; |
1409 | __u64 gid = 0xFFFFFFFFFFFFFFFFULL; | 1416 | __u64 gid = 0xFFFFFFFFFFFFFFFFULL; |
1410 | struct cifsInodeInfo *cifsInode; | 1417 | struct cifsInodeInfo *cifsInode; |
1418 | struct inode *inode = direntry->d_inode; | ||
1411 | 1419 | ||
1412 | xid = GetXid(); | 1420 | xid = GetXid(); |
1413 | 1421 | ||
1414 | cFYI(1, ("setattr on file %s attrs->iavalid 0x%x", | 1422 | cFYI(1, ("setattr on file %s attrs->iavalid 0x%x", |
1415 | direntry->d_name.name, attrs->ia_valid)); | 1423 | direntry->d_name.name, attrs->ia_valid)); |
1416 | 1424 | ||
1417 | cifs_sb = CIFS_SB(direntry->d_inode->i_sb); | 1425 | cifs_sb = CIFS_SB(inode->i_sb); |
1418 | pTcon = cifs_sb->tcon; | 1426 | pTcon = cifs_sb->tcon; |
1419 | 1427 | ||
1420 | if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) { | 1428 | if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) { |
1421 | /* check if we have permission to change attrs */ | 1429 | /* check if we have permission to change attrs */ |
1422 | rc = inode_change_ok(direntry->d_inode, attrs); | 1430 | rc = inode_change_ok(inode, attrs); |
1423 | if (rc < 0) { | 1431 | if (rc < 0) { |
1424 | FreeXid(xid); | 1432 | FreeXid(xid); |
1425 | return rc; | 1433 | return rc; |
@@ -1432,7 +1440,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1432 | FreeXid(xid); | 1440 | FreeXid(xid); |
1433 | return -ENOMEM; | 1441 | return -ENOMEM; |
1434 | } | 1442 | } |
1435 | cifsInode = CIFS_I(direntry->d_inode); | 1443 | cifsInode = CIFS_I(inode); |
1436 | 1444 | ||
1437 | if ((attrs->ia_valid & ATTR_MTIME) || (attrs->ia_valid & ATTR_SIZE)) { | 1445 | if ((attrs->ia_valid & ATTR_MTIME) || (attrs->ia_valid & ATTR_SIZE)) { |
1438 | /* | 1446 | /* |
@@ -1443,9 +1451,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1443 | will be truncated anyway? Also, should we error out here if | 1451 | will be truncated anyway? Also, should we error out here if |
1444 | the flush returns error? | 1452 | the flush returns error? |
1445 | */ | 1453 | */ |
1446 | rc = filemap_write_and_wait(direntry->d_inode->i_mapping); | 1454 | rc = filemap_write_and_wait(inode->i_mapping); |
1447 | if (rc != 0) { | 1455 | if (rc != 0) { |
1448 | CIFS_I(direntry->d_inode)->write_behind_rc = rc; | 1456 | cifsInode->write_behind_rc = rc; |
1449 | rc = 0; | 1457 | rc = 0; |
1450 | } | 1458 | } |
1451 | } | 1459 | } |
@@ -1521,9 +1529,8 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1521 | */ | 1529 | */ |
1522 | 1530 | ||
1523 | if (rc == 0) { | 1531 | if (rc == 0) { |
1524 | rc = cifs_vmtruncate(direntry->d_inode, attrs->ia_size); | 1532 | rc = cifs_vmtruncate(inode, attrs->ia_size); |
1525 | cifs_truncate_page(direntry->d_inode->i_mapping, | 1533 | cifs_truncate_page(inode->i_mapping, inode->i_size); |
1526 | direntry->d_inode->i_size); | ||
1527 | } else | 1534 | } else |
1528 | goto cifs_setattr_exit; | 1535 | goto cifs_setattr_exit; |
1529 | } | 1536 | } |
@@ -1557,7 +1564,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1557 | rc = 0; | 1564 | rc = 0; |
1558 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 1565 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
1559 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) | 1566 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) |
1560 | rc = mode_to_acl(direntry->d_inode, full_path, mode); | 1567 | rc = mode_to_acl(inode, full_path, mode); |
1561 | else if ((mode & S_IWUGO) == 0) { | 1568 | else if ((mode & S_IWUGO) == 0) { |
1562 | #else | 1569 | #else |
1563 | if ((mode & S_IWUGO) == 0) { | 1570 | if ((mode & S_IWUGO) == 0) { |
@@ -1665,7 +1672,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1665 | /* do not need local check to inode_check_ok since the server does | 1672 | /* do not need local check to inode_check_ok since the server does |
1666 | that */ | 1673 | that */ |
1667 | if (!rc) | 1674 | if (!rc) |
1668 | rc = inode_setattr(direntry->d_inode, attrs); | 1675 | rc = inode_setattr(inode, attrs); |
1669 | cifs_setattr_exit: | 1676 | cifs_setattr_exit: |
1670 | kfree(full_path); | 1677 | kfree(full_path); |
1671 | FreeXid(xid); | 1678 | FreeXid(xid); |