注意
本記事は、ある時期における特定条件について扱っています。
今後 Linux の CIFS 対応が進めば、解決するはずです。
再現環境
- CoreOS 1068.8.0 (MoreOS)
他のディストリビューションでも、同時期のカーネル/cifs-util なら再現する可能性が高そう。
症状(概要)
Azure 公式の Linux で Azure File Storage を使用する方法 に従ってマウントを行うと、下記のエラーが出て接続できない。
mount error(11): Resource temporarily unavailable
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
デバッグログを有効にして dmesg
を眺めると、下記のようなメッセージが見つかる。
[122546.048972] CIFS VFS: SMB3 encryption not supported yet
[122546.057942] CIFS VFS: SMB3 encryption not supported yet
[122546.072195] CIFS VFS: encrypted frame parsing not supported yet
[122546.080355] CIFS VFS: Bad protocol string signature header 424d53fd
[122546.091012] CIFS VFS: Bad SMB detected. The Mid=133996623437
mount.cifs
を実行したのは Azure 上の VMインスタンスで、Azure File Storage は VM と同一ロケーション(リージョン)に置いてある。
調査
日本語でググったところ、うまく行っている方々は、うまく行っている様子。
Azure File Storage を kubernetes のボリュームとして使ってみる
Azure Storageで作った"File"共有をcifsでマウントする方法が、CentOS 7.2でちゃんと動いた
しかし、CoreOS には issue が挙がっている
曰く、
We are currently running CoreOS 899.17.0 (stable) on Azure cloud with a drop-in mount.cifs that allows us to mount Azure File shares. In the current state we can successfully mount Azure File shares with smb 3.0 settings straight away, e.g.
sudo mount.cifs //myaccountname.file.core.windows.net/mysharename ./mymountpoint -o vers=3.0,username=myaccountname,password=StorageAccountKeyEndingIn==,dir_mode=0777,file_mode=0777
A couple of days ago we upgraded one of our boxes to a new stable version 1010.5.0 and immediately noticed that Azure File share was not working with the following error trail in the logs:
いくつかのやり取りを経て
I guess it is still a mystery why the behaviour of kernel has changed and why the previous version was falling back to 2.1 silently.
とのこと。
どうやら、下記のような状態らしい。
- 以前のカーネルでは、vers=3.0 でダメな場合は vers=2.1 で再試行していた
- ある時点でコードが修正され、vers=3.0 でエラーになる場合はvers=2.1 へfallbackしなくなった
- 現在の Linux の CIFS サポートは途上なので、vers=3.0 を指定した時に Azure File Storage が期待する encryption に Linux は応えられない。
実際、手元環境でマウント時のパラメタを vers=2.1 とすると、エラーなくマウントされる。1
結論
Azure File Storage の Linux からのマウントについては、本記事初出時点では、下記の2択しかない。
- CIFS サポートが更に強化されるまで、カーネルおよび cifs-util のアップデートを避ける。
- vers=3.0 での Azure File Storage のマウントを諦める。
影響(余談)
Kubernetes の AzureFile 周りに、vers=3.0 がハードコードされている箇所がある。
2016年7月現在のところ、新しめのカーネルで K8s の AzureFile ボリュームは使えない。
ver=2.1 での運用となるので制限はあるが、回避方法が示されている。しかし、Hyperkube の場合は別の問題(mount.cifsが含まれていない)があって、この手は使えない。 2
-
この場合、リージョンを跨いだマウントはできないはずなので、使い勝手は大きく制約されるのだが、それはさておき。 ↩
-
https://github.com/kubernetes/kubernetes/pull/34416 で mount.cifs も含まれるようになりました。やったね。 ↩