Browse Source

Merge pull request #10653 from Andy2244/cifsd_fix-reload

cifsd: update to git (2019-11-27), fix reload/restart not applying smb.conf changes
lilik-openwrt-22.03
Rosen Penev 5 years ago
committed by GitHub
parent
commit
e359ae57d4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 26 deletions
  1. +3
    -3
      kernel/cifsd/Makefile
  2. +4
    -4
      net/cifsd-tools/Makefile
  3. +1
    -1
      net/cifsd-tools/files/cifsd.config.example
  4. +36
    -17
      net/cifsd-tools/files/cifsd.init
  5. +1
    -1
      net/cifsd-tools/files/smb.conf.template

+ 3
- 3
kernel/cifsd/Makefile View File

@ -5,9 +5,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/cifsd-team/cifsd.git
PKG_SOURCE_DATE:=2019-11-22
PKG_SOURCE_VERSION:=511ee7e852c0be06b74fbb3eba69760b86658679
PKG_MIRROR_HASH:=23040d73230ff6afcea46cf9c51a1aab7b706859471de204da4824bfea5934c8
PKG_SOURCE_DATE:=2019-11-27
PKG_SOURCE_VERSION:=b8675c8ac144ece00f3e6bcc5436c8ace99e23e9
PKG_MIRROR_HASH:=3d67af87f30d837f95510663efc42f1451651dc235987408924b56cb277fc8e8
PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
PKG_LICENSE:=GPL-2.0-or-later


+ 4
- 4
net/cifsd-tools/Makefile View File

@ -5,9 +5,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/cifsd-team/cifsd-tools.git
PKG_SOURCE_DATE:=2019-11-25
PKG_SOURCE_VERSION:=49d0c40129fe22161999ffb7e059b90089f23078
PKG_MIRROR_HASH:=cd3702f1387ab643233200dcf5c244989b6d6efa196c69e842791e434eb3eea7
PKG_SOURCE_DATE:=2019-11-27
PKG_SOURCE_VERSION:=06fd4153a5d5af1f96a20234f397bd149a8e4832
PKG_MIRROR_HASH:=2849d2af471e327abc8d67afc91ca767c410e2b307d6554531a0b387d9ad909a
PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
PKG_LICENSE:=GPL-2.0-or-later
@ -46,7 +46,7 @@ define Package/cifsd-tools/install
$(INSTALL_BIN) ./files/cifsd.init $(1)/etc/init.d/cifsd
# copy examples until we have a wiki page
$(INSTALL_DATA) ./files/cifsd.config.example $(1)/etc/cifs/
$(INSTALL_DATA) ./files/smb.conf.help $(1)/etc/cifs/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/Documentation/configuration.txt $(1)/etc/cifs/
endef
define Package/cifsd-tools/conffiles


+ 1
- 1
net/cifsd-tools/files/cifsd.config.example View File

@ -4,8 +4,8 @@ config globals
config share
option name 'testshare'
option path '/tmp'
option read_only 'no'
option guest_ok 'yes'
option create_mask '0666'
option dir_mask '0777'
option writeable 'yes'
option force_root '1'

+ 36
- 17
net/cifsd-tools/files/cifsd.init View File

@ -103,12 +103,8 @@ smb_add_share()
[ -n "$browseable" ] && printf "\tbrowseable = %s\n" "$browseable"
[ -n "$read_only" ] && printf "\tread only = %s\n" "$read_only"
# possible upstream bug?
if [ "$read_only" = "no" ]; then
printf "\twriteable = yes\n"
else
[ -n "$writeable" ] && printf "\twriteable = %s\n" "$writeable"
fi
[ -n "$writeable" ] && printf "\twriteable = %s\n" "$writeable"
[ -n "$guest_ok" ] && printf "\tguest ok = %s\n" "$guest_ok"
[ -n "$inherit_owner" ] && printf "\tinherit owner = %s\n" "$inherit_owner"
@ -153,6 +149,15 @@ start_service()
exit 1
fi
if [ -e /sys/module/cifsd ]; then
if [ -e /sys/class/cifsd-control/kill_server ]; then
# upstream "BUG": ensure changes in smb.conf are reflected on a running kernel-server
echo hard > /sys/class/cifsd-control/kill_server
# we need a extra timeout for the reset
sleep 5
fi
fi
modprobe cifsd 2> /dev/null
if [ ! -e /sys/module/cifsd ]; then
logger -t 'cifsd' "modprobe of cifsd module failed, can\'t start cifsd!"
@ -162,6 +167,7 @@ start_service()
logger -t 'cifsd' "Starting CIFS/SMB userspace service."
procd_open_instance
procd_set_param command /usr/sbin/cifsd --n
procd_set_param file /var/etc/cifs/smb.conf
procd_close_instance
}
@ -169,20 +175,33 @@ stop_service()
{
logger -t 'cifsd' "Stopping CIFSD userspace service."
killall cifsd > /dev/null 2>&1
sleep 1
[ -e /sys/class/cifsd-control/kill_server ] && echo hard > /sys/class/cifsd-control/kill_server
sleep 2
[ -e /sys/module/cifsd ] && rmmod cifsd > /dev/null 2>&1
# With open smb connections rmmod is not possible, without waiting for the long 'ipc timeout', so we use 'kill_server'!
if [ -e /sys/module/cifsd ]; then
logger -t 'cifsd' "triggering kill_server"
if [ -e /sys/class/cifsd-control/kill_server ]; then
echo hard > /sys/class/cifsd-control/kill_server
# we need a extra timeout for the reset
sleep 5
fi
fi
# next try
[ -e /sys/module/cifsd ] && rmmod cifsd > /dev/null 2>&1
# With open smb connections rmmod takes longer
# check again
if [ -e /sys/module/cifsd ]; then
sleep 5
rmmod cifsd > /dev/null 2>&1
# wait more...
sleep 3
fi
# last try
[ -e /sys/module/cifsd ] && rmmod cifsd > /dev/null 2>&1
if [ -e /sys/module/cifsd ]; then
logger -t 'cifsd' "module still loaded after 8s timeout"
fi
[ -f /tmp/cifsd.lock ] && rm /tmp/cifsd.lock
}
reload_service() {
stop_service "$@"
sleep 1
start_service "$@"
}
# reload_service() {
# restart "$@"
# }

+ 1
- 1
net/cifsd-tools/files/smb.conf.template View File

@ -4,6 +4,6 @@
workgroup = |WORKGROUP|
interfaces = |INTERFACES|
bind interfaces only = yes
ipc timeout = 8
ipc timeout = 20
deadtime = 15
map to guest = Bad User

Loading…
Cancel
Save