.smbdeleteって何のファイル?

ある日NASの共有フォルダに「.smbdelete<~xxxxx~>」というファイルが生成されているのを見つけて、何だこれは?と思って少し調べてみました。
するとNASをSMB接続しているマウント先で他のプロセスがオープンしているファイルを削除しようとしたときにOS Xが処理をする際に作成されるファイルだそう。
みたところOS X10.10以降からこのファイルを作成する処理が入っているらしいコメントを発見しました。以下はその抜粋です。
https://opensource.apple.com/source/smb/smb-759.40.1/kernel/smbfs/smbfs_smb.c

* We have an open file that they want to delete. Use the NFS silly rename
* trick, but try to do better than NFS. The picking of the name came from the
* NFS code. So we first open the file for deletion. Now come up with a new
* name and rename the file. Make the file hidden if we can. Now lets mark
* it for deletion and close the file. If the rename fails then the whole call
* should fail. If the mark for deletion call fails just set a flag on the
* vnode and delete it when we close.

私が見つけたときは1ヶ月以上前に作成されたファイルのようで特に影響がなさそうなので削除しました。

シェアする