aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/inode.c
diff options
context:
space:
mode:
authorSuresh Jayaraman <sjayaraman@suse.de>2009-06-25 08:42:34 -0400
committerSteve French <sfrench@us.ibm.com>2009-06-25 15:12:57 -0400
commit0f3bc09ee1b7fcadd5bfdc5ed2e1643f658fe23d (patch)
treefdbbdeeefcc1b480990cb6a687387c1e232a39e0 /fs/cifs/inode.c
parentf46c7234e472ceee39afea4fb5a4365843e1850a (diff)
cifs: Fix incorrect return code being printed in cFYI messages
FreeXid() along with freeing Xid does add a cifsFYI debug message that prints rc (return code) as well. In some code paths where we set/return error code after calling FreeXid(), incorrect error code is being printed when cifsFYI is enabled. This could be misleading in few cases. For eg. In cifs_open() if cifs_fill_filedata() returns a valid pointer to cifsFileInfo, FreeXid() prints rc=-13 whereas 0 is actually being returned. Fix this by setting rc before calling FreeXid(). Basically convert FreeXid(xid); rc = -ERR; return -ERR; => FreeXid(xid); return rc; [Note that Christoph would like to replace the GetXid/FreeXid calls, which are primarily used for debugging. This seems like a good longer term goal, but although there is an alternative tracing facility, there are no examples yet available that I know of that we can use (yet) to convert this cifs function entry/exit logging, and for creating an identifier that we can use to correlate all dmesg log entries for a particular vfs operation (ie identify all log entries for a particular vfs request to cifs: e.g. a particular close or read or write or byte range lock call ... and just using the thread id is harder). Eventually when a replacement for this is available (e.g. when NFS switches over and various samples to look at in other file systems) we can remove the GetXid/FreeXid macro but in the meantime multiple people use this run time configurable logging all the time for debugging, and Suresh's patch fixes a problem which made it harder to notice some low memory problems in the log so it is worthwhile to fix this problem until a better logging approach is able to be used] Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r--fs/cifs/inode.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index fad882b075ba..155c9e785d0c 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -988,8 +988,9 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry)
988 * sb->s_vfs_rename_mutex here */ 988 * sb->s_vfs_rename_mutex here */
989 full_path = build_path_from_dentry(dentry); 989 full_path = build_path_from_dentry(dentry);
990 if (full_path == NULL) { 990 if (full_path == NULL) {
991 rc = -ENOMEM;
991 FreeXid(xid); 992 FreeXid(xid);
992 return -ENOMEM; 993 return rc;
993 } 994 }
994 995
995 if ((tcon->ses->capabilities & CAP_UNIX) && 996 if ((tcon->ses->capabilities & CAP_UNIX) &&
@@ -1118,8 +1119,9 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
1118 1119
1119 full_path = build_path_from_dentry(direntry); 1120 full_path = build_path_from_dentry(direntry);
1120 if (full_path == NULL) { 1121 if (full_path == NULL) {
1122 rc = -ENOMEM;
1121 FreeXid(xid); 1123 FreeXid(xid);
1122 return -ENOMEM; 1124 return rc;
1123 } 1125 }
1124 1126
1125 if ((pTcon->ses->capabilities & CAP_UNIX) && 1127 if ((pTcon->ses->capabilities & CAP_UNIX) &&
@@ -1303,8 +1305,9 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
1303 1305
1304 full_path = build_path_from_dentry(direntry); 1306 full_path = build_path_from_dentry(direntry);
1305 if (full_path == NULL) { 1307 if (full_path == NULL) {
1308 rc = -ENOMEM;
1306 FreeXid(xid); 1309 FreeXid(xid);
1307 return -ENOMEM; 1310 return rc;
1308 } 1311 }
1309 1312
1310 rc = CIFSSMBRmDir(xid, pTcon, full_path, cifs_sb->local_nls, 1313 rc = CIFSSMBRmDir(xid, pTcon, full_path, cifs_sb->local_nls,
@@ -1508,8 +1511,9 @@ int cifs_revalidate(struct dentry *direntry)
1508 since that would deadlock */ 1511 since that would deadlock */
1509 full_path = build_path_from_dentry(direntry); 1512 full_path = build_path_from_dentry(direntry);
1510 if (full_path == NULL) { 1513 if (full_path == NULL) {
1514 rc = -ENOMEM;
1511 FreeXid(xid); 1515 FreeXid(xid);
1512 return -ENOMEM; 1516 return rc;
1513 } 1517 }
1514 cFYI(1, ("Revalidate: %s inode 0x%p count %d dentry: 0x%p d_time %ld " 1518 cFYI(1, ("Revalidate: %s inode 0x%p count %d dentry: 0x%p d_time %ld "
1515 "jiffies %ld", full_path, direntry->d_inode, 1519 "jiffies %ld", full_path, direntry->d_inode,
@@ -1911,8 +1915,9 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
1911 1915
1912 full_path = build_path_from_dentry(direntry); 1916 full_path = build_path_from_dentry(direntry);
1913 if (full_path == NULL) { 1917 if (full_path == NULL) {
1918 rc = -ENOMEM;
1914 FreeXid(xid); 1919 FreeXid(xid);
1915 return -ENOMEM; 1920 return rc;
1916 } 1921 }
1917 1922
1918 /* 1923 /*