@@ -1025,16 +1025,18 @@ static int s3fs_unlink(const char* path)
10251025
10261026 S3FS_PRN_INFO (" [path=%s]" , path);
10271027
1028+ int pid = -1 ;
10281029 struct fuse_context * pcxt;
10291030 if (NULL != (pcxt = fuse_get_context ())){
1031+ pid = pcxt->pid ;
10301032 S3FS_PRN_INFO (" %s, uid=[%d], gid=[%d], pid=[%d]" , __FUNCTION__, pcxt->uid , pcxt->gid , pcxt->pid );
10311033 }
10321034
10331035 if (0 != (result = check_parent_object_access (path, W_OK | X_OK))){
10341036 return result;
10351037 }
10361038 S3fsCurl s3fscurl;
1037- result = s3fscurl.DeleteRequest (path);
1039+ result = s3fscurl.DeleteRequest (path, pid );
10381040 FdManager::DeleteCacheFile (path);
10391041 StatCache::getStatCacheData ()->DelStat (path);
10401042 S3FS_MALLOCTRIM (0 );
@@ -1065,8 +1067,10 @@ static int s3fs_rmdir(const char* path)
10651067
10661068 S3FS_PRN_INFO (" [path=%s]" , path);
10671069
1070+ int pid = -1 ;
10681071 struct fuse_context * pcxt;
10691072 if (NULL != (pcxt = fuse_get_context ())){
1073+ pid = pcxt->pid ;
10701074 S3FS_PRN_INFO (" %s, uid=[%d], gid=[%d], pid=[%d]" , __FUNCTION__, pcxt->uid , pcxt->gid , pcxt->pid );
10711075 }
10721076
@@ -1084,7 +1088,7 @@ static int s3fs_rmdir(const char* path)
10841088 strpath += " /" ;
10851089 }
10861090 S3fsCurl s3fscurl;
1087- result = s3fscurl.DeleteRequest (strpath.c_str ());
1091+ result = s3fscurl.DeleteRequest (strpath.c_str (), pid );
10881092 s3fscurl.DestroyCurlHandle ();
10891093 StatCache::getStatCacheData ()->DelStat (strpath.c_str ());
10901094
@@ -1099,7 +1103,7 @@ static int s3fs_rmdir(const char* path)
10991103 if (0 == get_object_attribute (strpath.c_str (), &stbuf, NULL , false )){
11001104 if (S_ISDIR (stbuf.st_mode )){
11011105 // Found "dir" object.
1102- result = s3fscurl.DeleteRequest (strpath.c_str ());
1106+ result = s3fscurl.DeleteRequest (strpath.c_str (), pid );
11031107 s3fscurl.DestroyCurlHandle ();
11041108 StatCache::getStatCacheData ()->DelStat (strpath.c_str ());
11051109 }
@@ -1111,7 +1115,7 @@ static int s3fs_rmdir(const char* path)
11111115 // This processing is necessary for other OSS clients compatibility.
11121116 if (is_special_name_folder_object (strpath.c_str ())){
11131117 strpath += " _$folder$" ;
1114- result = s3fscurl.DeleteRequest (strpath.c_str ());
1118+ result = s3fscurl.DeleteRequest (strpath.c_str (), pid );
11151119 }
11161120 S3FS_MALLOCTRIM (0 );
11171121
@@ -1566,8 +1570,10 @@ static int s3fs_chmod(const char* path, mode_t mode)
15661570
15671571 S3FS_PRN_INFO (" [path=%s][mode=%04o]" , path, mode);
15681572
1573+ int pid = -1 ;
15691574 struct fuse_context * pcxt;
15701575 if (NULL != (pcxt = fuse_get_context ())){
1576+ pid = pcxt->pid ;
15711577 S3FS_PRN_INFO (" %s, uid=[%d], gid=[%d], pid=[%d]" , __FUNCTION__, pcxt->uid , pcxt->gid , pcxt->pid );
15721578 }
15731579
@@ -1600,7 +1606,7 @@ static int s3fs_chmod(const char* path, mode_t mode)
16001606 // At first, remove directory old object
16011607 if (IS_RMTYPEDIR (nDirType)){
16021608 S3fsCurl s3fscurl;
1603- if (0 != (result = s3fscurl.DeleteRequest (strpath.c_str ()))){
1609+ if (0 != (result = s3fscurl.DeleteRequest (strpath.c_str (), pid ))){
16041610 return result;
16051611 }
16061612 }
@@ -1665,8 +1671,10 @@ static int s3fs_chmod_nocopy(const char* path, mode_t mode)
16651671
16661672 S3FS_PRN_INFO1 (" [path=%s][mode=%04o]" , path, mode);
16671673
1674+ int pid = -1 ;
16681675 struct fuse_context * pcxt;
16691676 if (NULL != (pcxt = fuse_get_context ())){
1677+ pid = pcxt->pid ;
16701678 S3FS_PRN_INFO (" %s, uid=[%d], gid=[%d], pid=[%d]" , __FUNCTION__, pcxt->uid , pcxt->gid , pcxt->pid );
16711679 }
16721680
@@ -1700,7 +1708,7 @@ static int s3fs_chmod_nocopy(const char* path, mode_t mode)
17001708 // At first, remove directory old object
17011709 if (IS_RMTYPEDIR (nDirType)){
17021710 S3fsCurl s3fscurl;
1703- if (0 != (result = s3fscurl.DeleteRequest (strpath.c_str ()))){
1711+ if (0 != (result = s3fscurl.DeleteRequest (strpath.c_str (), pid ))){
17041712 return result;
17051713 }
17061714 }
@@ -1750,8 +1758,10 @@ static int s3fs_chown(const char* path, uid_t uid, gid_t gid)
17501758
17511759 S3FS_PRN_INFO (" [path=%s][uid=%u][gid=%u]" , path, (unsigned int )uid, (unsigned int )gid);
17521760
1761+ int pid = -1 ;
17531762 struct fuse_context * pcxt;
17541763 if (NULL != (pcxt = fuse_get_context ())){
1764+ pid = pcxt->pid ;
17551765 S3FS_PRN_INFO (" %s, uid=[%d], gid=[%d], pid=[%d]" , __FUNCTION__, pcxt->uid , pcxt->gid , pcxt->pid );
17561766 }
17571767
@@ -1799,7 +1809,7 @@ static int s3fs_chown(const char* path, uid_t uid, gid_t gid)
17991809 // At first, remove directory old object
18001810 if (IS_RMTYPEDIR (nDirType)){
18011811 S3fsCurl s3fscurl;
1802- if (0 != (result = s3fscurl.DeleteRequest (strpath.c_str ()))){
1812+ if (0 != (result = s3fscurl.DeleteRequest (strpath.c_str (), pid ))){
18031813 return result;
18041814 }
18051815 }
@@ -1864,8 +1874,10 @@ static int s3fs_chown_nocopy(const char* path, uid_t uid, gid_t gid)
18641874 int nDirType = DIRTYPE_UNKNOWN;
18651875
18661876 S3FS_PRN_INFO1 (" [path=%s][uid=%u][gid=%u]" , path, (unsigned int )uid, (unsigned int )gid);
1877+ int pid = -1 ;
18671878 struct fuse_context * pcxt;
18681879 if (NULL != (pcxt = fuse_get_context ())){
1880+ pid = pcxt->pid ;
18691881 S3FS_PRN_INFO (" %s, uid=[%d], gid=[%d], pid=[%d]" , __FUNCTION__, pcxt->uid , pcxt->gid , pcxt->pid );
18701882 }
18711883
@@ -1908,7 +1920,7 @@ static int s3fs_chown_nocopy(const char* path, uid_t uid, gid_t gid)
19081920 // At first, remove directory old object
19091921 if (IS_RMTYPEDIR (nDirType)){
19101922 S3fsCurl s3fscurl;
1911- if (0 != (result = s3fscurl.DeleteRequest (strpath.c_str ()))){
1923+ if (0 != (result = s3fscurl.DeleteRequest (strpath.c_str (), pid ))){
19121924 return result;
19131925 }
19141926 }
@@ -1958,8 +1970,10 @@ static int s3fs_utimens(const char* path, const struct timespec ts[2])
19581970 int nDirType = DIRTYPE_UNKNOWN;
19591971
19601972 S3FS_PRN_INFO (" [path=%s][mtime=%jd]" , path, (intmax_t )(ts[1 ].tv_sec ));
1973+ int pid = -1 ;
19611974 struct fuse_context * pcxt;
19621975 if (NULL != (pcxt = fuse_get_context ())){
1976+ pid = pcxt->pid ;
19631977 S3FS_PRN_INFO (" %s, uid=[%d], gid=[%d], pid=[%d]" , __FUNCTION__, pcxt->uid , pcxt->gid , pcxt->pid );
19641978 }
19651979
@@ -1994,7 +2008,7 @@ static int s3fs_utimens(const char* path, const struct timespec ts[2])
19942008 // At first, remove directory old object
19952009 if (IS_RMTYPEDIR (nDirType)){
19962010 S3fsCurl s3fscurl;
1997- if (0 != (result = s3fscurl.DeleteRequest (strpath.c_str ()))){
2011+ if (0 != (result = s3fscurl.DeleteRequest (strpath.c_str (), pid ))){
19982012 return result;
19992013 }
20002014 }
@@ -2056,8 +2070,10 @@ static int s3fs_utimens_nocopy(const char* path, const struct timespec ts[2])
20562070 int nDirType = DIRTYPE_UNKNOWN;
20572071
20582072 S3FS_PRN_INFO1 (" [path=%s][mtime=%s]" , path, str (ts[1 ].tv_sec ).c_str ());
2073+ int pid = -1 ;
20592074 struct fuse_context * pcxt;
20602075 if (NULL != (pcxt = fuse_get_context ())){
2076+ pid = pcxt->pid ;
20612077 S3FS_PRN_INFO (" %s, uid=[%d], gid=[%d], pid=[%d]" , __FUNCTION__, pcxt->uid , pcxt->gid , pcxt->pid );
20622078 }
20632079
@@ -2093,7 +2109,7 @@ static int s3fs_utimens_nocopy(const char* path, const struct timespec ts[2])
20932109 // At first, remove directory old object
20942110 if (IS_RMTYPEDIR (nDirType)){
20952111 S3fsCurl s3fscurl;
2096- if (0 != (result = s3fscurl.DeleteRequest (strpath.c_str ()))){
2112+ if (0 != (result = s3fscurl.DeleteRequest (strpath.c_str (), pid ))){
20972113 return result;
20982114 }
20992115 }
@@ -3223,6 +3239,13 @@ static int s3fs_setxattr(const char* path, const char* name, const char* value,
32233239 }
32243240#endif
32253241
3242+ int pid = -1 ;
3243+ struct fuse_context * pcxt;
3244+ if (NULL != (pcxt = fuse_get_context ())){
3245+ pid = pcxt->pid ;
3246+ S3FS_PRN_INFO (" %s, uid=[%d], gid=[%d], pid=[%d]" , __FUNCTION__, pcxt->uid , pcxt->gid , pcxt->pid );
3247+ }
3248+
32263249 int result;
32273250 string strpath;
32283251 string newpath;
@@ -3265,7 +3288,7 @@ static int s3fs_setxattr(const char* path, const char* name, const char* value,
32653288 // At first, remove directory old object
32663289 if (IS_RMTYPEDIR (nDirType)){
32673290 S3fsCurl s3fscurl;
3268- if (0 != (result = s3fscurl.DeleteRequest (strpath.c_str ()))){
3291+ if (0 != (result = s3fscurl.DeleteRequest (strpath.c_str (), pid ))){
32693292 return result;
32703293 }
32713294 }
@@ -3497,8 +3520,10 @@ static int s3fs_listxattr(const char* path, char* list, size_t size)
34973520static int s3fs_removexattr (const char * path, const char * name)
34983521{
34993522 S3FS_PRN_INFO (" [path=%s][name=%s]" , path, name);
3523+ int pid = -1 ;
35003524 struct fuse_context * pcxt;
35013525 if (NULL != (pcxt = fuse_get_context ())){
3526+ pid = pcxt->pid ;
35023527 S3FS_PRN_INFO (" %s, uid=[%d], gid=[%d], pid=[%d]" , __FUNCTION__, pcxt->uid , pcxt->gid , pcxt->pid );
35033528 }
35043529
@@ -3575,7 +3600,7 @@ static int s3fs_removexattr(const char* path, const char* name)
35753600 // At first, remove directory old object
35763601 if (IS_RMTYPEDIR (nDirType)){
35773602 S3fsCurl s3fscurl;
3578- if (0 != (result = s3fscurl.DeleteRequest (strpath.c_str ()))){
3603+ if (0 != (result = s3fscurl.DeleteRequest (strpath.c_str (), pid ))){
35793604 free_xattrs (xattrs);
35803605 return result;
35813606 }
@@ -4633,6 +4658,10 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar
46334658 FdManager::SetCacheDir (strchr (arg, ' =' ) + sizeof (char ));
46344659 return 0 ;
46354660 }
4661+ if (0 == STR2NCMP (arg, " enable_clientinfo" )){
4662+ S3fsCurl::SetClientInfoInDelete (true );
4663+ return 0 ;
4664+ }
46364665 if (0 == strcmp (arg, " del_cache" )){
46374666 is_remove_cache = true ;
46384667 return 0 ;
0 commit comments