Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ttyGS0 after wakeup not working #8

Closed
junwushi opened this issue Jul 3, 2017 · 11 comments
Closed

ttyGS0 after wakeup not working #8

junwushi opened this issue Jul 3, 2017 · 11 comments

Comments

@junwushi
Copy link

junwushi commented Jul 3, 2017

please check.

@yachen
Copy link

yachen commented Jul 4, 2017

What USB to serial device are you using? FTDI, Prolific, or others?

@junwushi
Copy link
Author

junwushi commented Jul 4, 2017

gadget in usb0

@yachen
Copy link

yachen commented Jul 4, 2017

Hi, yes I know it's the gadget device. May I know its controller? We've tested other gadget device and function perperly after systrem wake up. I'd like to test the same device if possible.

@junwushi
Copy link
Author

junwushi commented Jul 4, 2017

there are not cable with controller,only usb cable connect pc in usb0

@yachen
Copy link

yachen commented Jul 4, 2017

Are you testing USB host or USB device of NUC970?

@junwushi
Copy link
Author

junwushi commented Jul 4, 2017

yes

@junwushi
Copy link
Author

junwushi commented Jul 4, 2017

U-Boot 2013.04-rc2-ge877f9c-dirty (May 29 2017 - 15:08:53)

CPU: NUC972
DRAM: 64 MiB
NAND: 128 MiB
MMC: mmc: 0
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
Net: emac
Hit any key to stop autoboot: 0

Loading from nand0, offset 0x200000
Image Name: Linux-3.10.106-00955-g6ec51e32a2
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 3050528 Bytes = 2.9 MiB
Load Address: 00007fc0
Entry Point: 00008000

Booting kernel from Legacy Image at 00007fc0 ...

Image Name: Linux-3.10.106-00955-g6ec51e32a2
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 3050528 Bytes = 2.9 MiB
Load Address: 00007fc0
Entry Point: 00008000
Verifying Checksum ... �[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.10.106-00955-g6ec51e32a27-dirty (jwshi@leo-VirtualBox) (gcc version 6.2.0 (GCC) ) #123 PREEMPT Mon Jul 3 18:21:12 CST 2017
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] Machine: NUC970
[ 0.000000] cma: CMA: reserved 4 MiB at 03c00000
[ 0.000000] Memory policy: ECC disabled, Data cache writeback
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
[ 0.000000] Kernel command line: noinitrd root=/dev/mtdblock2 rootfstype=yaffs2 rw rootflags=inband-tags console=ttyS0,115200n8 init=/sbin/init mem=64M lpj=744448 vt.global_cursor_default=0
[ 0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Memory: 64MB = 64MB total
[ 0.000000] Memory: 54364k/54364k available, 11172k reserved, 0K highmem
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
[ 0.000000] vmalloc : 0xc4800000 - 0xff000000 ( 936 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xc4000000 ( 64 MB)
[ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
[ 0.000000] .text : 0xc0008000 - 0xc059eecc (5724 kB)
[ 0.000000] .init : 0xc059f000 - 0xc05d6240 ( 221 kB)
[ 0.000000] .data : 0xc05d8000 - 0xc0622980 ( 299 kB)
[ 0.000000] .bss : 0xc0622980 - 0xc064bd6c ( 165 kB)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] Preemptible hierarchical RCU implementation.
[ 0.000000] NR_IRQS:625
[ 0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
[ 0.000000] Console: colour dummy device 80x30
[ 0.000000] console [ttyS0] enabled
[ 0.130000] Calibrating delay loop (skipped) preset value.. 148.88 BogoMIPS (lpj=744448)
[ 0.140000] pid_max: default: 32768 minimum: 301
[ 0.150000] Mount-cache hash table entries: 512
[ 0.150000] Initializing cgroup subsys devices
[ 0.160000] Initializing cgroup subsys freezer
[ 0.160000] Initializing cgroup subsys perf_event
[ 0.170000] CPU: Testing write buffer coherency: ok
[ 0.170000] Setting up static identity map for 0xc04715a0 - 0xc04715f8
[ 0.180000] devtmpfs: initialized
[ 0.270000] pinctrl core: initialized pinctrl subsystem
[ 0.280000] NET: Registered protocol family 16
[ 0.290000] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.450000] bio: create slab at 0
[ 0.460000] usbcore: registered new interface driver usbfs
[ 0.470000] usbcore: registered new interface driver hub
[ 0.480000] usbcore: registered new device driver usb
[ 0.490000] NET: Registered protocol family 23
[ 0.500000] FS-Cache: Loaded
[ 0.500000] CacheFiles: Loaded
[ 0.600000] NET: Registered protocol family 2
[ 0.610000] TCP established hash table entries: 512 (order: 0, 4096 bytes)
[ 0.620000] TCP bind hash table entries: 512 (order: -1, 2048 bytes)
[ 0.630000] TCP: Hash tables configured (established 512 bind 512)
[ 0.630000] TCP: reno registered
[ 0.630000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.640000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.650000] NET: Registered protocol family 1
[ 0.650000] NetWinder Floating Point Emulator V0.97 (double precision)
[ 0.740000] DLM installed
[ 0.740000] fuse init (API version 7.22)
[ 0.750000] msgmni has been set to 114
[ 0.770000] NET: Registered protocol family 38
[ 0.780000] Key type asymmetric registered
[ 0.780000] Asymmetric key parser 'x509' registered
[ 0.790000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[ 0.790000] io scheduler noop registered
[ 0.800000] io scheduler deadline registered
[ 0.800000] io scheduler cfq registered (default)
[ 0.820000] [nuc970fb_probe] 10
[ 0.830000] Console: switching to colour frame buffer device 40x15
[ 0.850000] lcd-16bit
[ 0.850000] fb0: nuc970fb frame buffer device
[ 1.070000] ST7789V LCD init done.
[ 1.070000] nuc970_dma_probe - pdev = nuc970-dma-m2m
[ 1.080000] nuc970-dma nuc970-dma-m2m: NUC970 M2M DMA ready
[ 1.110000] nuc970-uart.0: ttyS0 at I/O 0x0 (irq = 36) is a NUC970
[ 1.120000] nuc970-uart.1: ttyS1 at I/O 0x0 (irq = 37) is a NUC970
[ 1.130000] nuc970-uart.2: ttyS2 at I/O 0x0 (irq = 38) is a NUC970
[ 1.130000] nuc970-uart.3: ttyS3 at I/O 0x0 (irq = 43) is a NUC970
[ 1.140000] nuc970-uart.5: ttyS5 at I/O 0x0 (irq = 44) is a NUC970
[ 1.150000] nuc970-uart.6: ttyS6 at I/O 0x0 (irq = 40) is a NUC970
[ 1.160000] nuc970-uart.8: ttyS8 at I/O 0x0 (irq = 41) is a NUC970
[ 1.170000] nuc970-uart.10: ttyS10 at I/O 0x0 (irq = 42) is a NUC970
[ 1.180000] nuc970_dma_proxy module initialized
[ 1.190000] [drm] Initialized drm 1.1.0 20060810
[ 1.220000] loop: module loaded
[ 1.230000] nbd: registered device at major 43
[ 1.290000] nuc970 mtd nand driver version: 20160331
[ 1.290000] NAND device: Manufacturer ID: 0xef, Chip ID: 0xf1 (Winbond NAND 128MiB 3,3V 8-bit), 128MiB, page size: 2048, OOB size: 64
[ 1.300000] SYSTEM: USE BCH_T4 HWECC algorithm(SMRA size: 64, Parity number:32 bytes)
[ 1.300000] EXECUTE: USE BCH_T4 HWECC algorithm(SMRA size: 64, Parity number:32 bytes)
[ 1.310000] USE BCH_T4 HWECC algorithm(Parity number:32 bytes)
[ 1.320000] Bad block table not found for chip 0
[ 1.320000] Bad block table not found for chip 0
[ 1.330000] Scanning device for bad blocks
[ 1.330000] Bad eraseblock 0 at 0x000000000000
[ 1.390000] Bad block table written to 0x000007fe0000, version 0x01
[ 1.400000] Bad block table written to 0x000007fc0000, version 0x01
[ 1.410000] Creating 3 MTD partitions on "nand0":
[ 1.410000] 0x000000000000-0x000000200000 : "u-boot"
[ 1.420000] 0x000000200000-0x000000a00000 : "Kernel"
[ 1.430000] 0x000000a00000-0x000008000000 : "user"
[ 1.450000] fmi-sm: registered successfully! mtdid=nand0
[ 1.450000] HSI/SSI char device loaded
[ 1.460000] tun: Universal TUN/TAP device driver, 1.6
[ 1.460000] tun: (C) 1999-2004 Max Krasnyansky maxk@qualcomm.com
[ 1.480000] libphy: nuc970_rmii0: probed
[ 1.490000] PPP generic driver version 2.4.2
[ 1.500000] PPP BSD Compression module registered
[ 1.500000] PPP Deflate Compression module registered
[ 1.510000] PPP MPPE Compression module registered
[ 1.510000] NET: Registered protocol family 24
[ 1.520000] SLIP: version 0.8.4-NET3.019-NEWTTY (dynamic channels, max=256).
[ 1.520000] CSLIP: code copyright 1989 Regents of the University of California.
[ 1.530000] hdlc: HDLC support module revision 1.22
[ 1.540000] ieee802154hardmac ieee802154hardmac: Added ieee802154 HardMAC hardware
[ 1.550000] ieee802154fakelb ieee802154fakelb: added ieee802154 hardware
[ 1.560000] usbcore: registered new interface driver rtl8150
[ 1.570000] usbcore: registered new interface driver r8152
[ 1.570000] usbcore: registered new interface driver cdc_ether
[ 1.580000] usbcore: registered new interface driver cdc_eem
[ 1.590000] usbcore: registered new interface driver rndis_host
[ 1.600000] usbcore: registered new interface driver cdc_ncm
[ 1.600000] usbcore: registered new interface driver cdc_mbim
[ 1.610000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.620000] ehci_nuc970_probe() - name: nuc970-ehci
[ 1.620000] nuc970-ehci nuc970-ehci: Nuvoton NUC970 EHCI Host Controller
[ 1.630000] nuc970-ehci nuc970-ehci: new USB bus registered, assigned bus number 1
[ 1.640000] nuc970-ehci nuc970-ehci: irq 23, io mem 0xb0005000
[ 1.670000] nuc970-ehci nuc970-ehci: USB 2.0 started, EHCI 0.95
[ 1.670000] hub 1-0:1.0: USB hub found
[ 1.680000] hub 1-0:1.0: 2 ports detected
[ 1.680000] ehci-platform: EHCI generic platform driver
[ 1.690000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.700000] nuc970-ohci nuc970-ohci: Nuvoton NUC970 OHCI Host Controller
[ 1.700000] nuc970-ohci nuc970-ohci: new USB bus registered, assigned bus number 2
[ 1.710000] nuc970-ohci nuc970-ohci: irq 24, io mem 0xb0007000
[ 1.780000] hub 2-0:1.0: USB hub found
[ 1.780000] hub 2-0:1.0: 2 ports detected
[ 1.790000] usbcore: registered new interface driver cdc_acm
[ 1.800000] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[ 1.810000] usbcore: registered new interface driver usblp
[ 1.810000] usbcore: registered new interface driver cdc_wdm
[ 1.820000] usbcore: registered new interface driver usbserial
[ 1.830000] usbcore: registered new interface driver ftdi_sio
[ 1.830000] usbserial: USB Serial support registered for FTDI USB Serial Device
[ 1.840000] usbcore: registered new interface driver option
[ 1.850000] usbserial: USB Serial support registered for GSM modem (1-port)
[ 1.860000] usbcore: registered new interface driver pl2303
[ 1.870000] usbserial: USB Serial support registered for pl2303
[ 1.880000] g_serial gadget: Gadget Serial v2.4
[ 1.880000] g_serial gadget: g_serial ready
[ 1.890000] input: nuc970-kpi as /devices/platform/nuc970-kpi/input/input0
[ 1.900000] nuc970-rtc nuc970-rtc: rtc core: registered nuc970-rtc as rtc0
[ 1.930000] NUC970 Crypto engine enabled.
[ 1.940000] hidraw: raw HID events driver (C) Jiri Kosina
[ 1.960000] usbcore: registered new interface driver usbhid
[ 1.970000] usbhid: USB HID core driver
[ 1.970000] nuc970-nadc: nuc970 Normal ADC adapter
[ 1.980000] NET: Registered protocol family 26
[ 1.980000] ipip: IPv4 over IPv4 tunneling driver
[ 1.990000] IPv4 over IPSec tunneling driver
[ 2.000000] TCP: cubic registered
[ 2.010000] NET: Registered protocol family 10
[ 2.020000] mip6: Mobile IPv6
[ 2.030000] sit: IPv6 over IPv4 tunneling driver
[ 2.040000] ip6_gre: GRE over IPv6 tunneling driver
[ 2.050000] NET: Registered protocol family 17
[ 2.050000] NET: Registered protocol family 15
[ 2.060000] Bridge firewalling registered
[ 2.060000] l2tp_core: L2TP core driver, V2.0
[ 2.070000] l2tp_ppp: PPPoL2TP kernel driver, V2.0
[ 2.070000] l2tp_ip: L2TP IP encapsulation support (L2TPv3)
[ 2.080000] l2tp_netlink: L2TP netlink interface
[ 2.080000] l2tp_eth: L2TP ethernet pseudowire support (L2TPv3)
[ 2.090000] l2tp_ip6: L2TP IP encapsulation support for IPv6 (L2TPv3)
[ 2.100000] sctp: Hash tables configured (established 2048 bind 4096)
[ 2.110000] lib80211: common routines for IEEE802.11 drivers
[ 2.110000] NET: Registered protocol family 36
[ 2.130000] Key type encrypted registered
[ 2.130000] g_serial gadget: high-speed config #2: CDC ACM config
[ 2.140000] nuc970-rtc nuc970-rtc: setting system clock to 2017-02-09 03:55:13 UTC (1486612513)
[ 2.150000] yaffs: dev is 32505858 name is "mtdblock2" rw
[ 2.160000] yaffs: passed flags "inband-tags"
[ 3.540000] VFS: Mounted root (yaffs2 filesystem) on device 31:2.
[ 3.540000] devtmpfs: mounted
[ 3.550000] Freeing unused kernel memory: 220K (c059f000 - c05d6000)
INIT~version 2.88 boot
Starting udev
[ 4.370000] udevd[681]: starting version 3.2
[ 4.500000] udevd[682]: starting eudev-3.2
Populating dev cache
INIT: Entering runlevel: 5
Configuring network interfaces... done.
Starting syslogd/klogd: done
nohup: appending output to nohup.out
[ 10.310000] input: virtual keyboard as /devices/virtual/input/input1

HHT /dev/ttyS0

HHT login: root
root@HHT:~#

@junwushi
Copy link
Author

junwushi commented Jul 4, 2017

i am check in EV board that first time is working, second wakeup it is not working
root@HHT:
[ 131.380000] PM: Syncing filesystems ... done.
[ 131.420000] Freezing user space processes ... (elapsed 0.02 seconds) done.
[ 131.460000] Freezing remaining freezable tasks ... (elapsed 0.02 seconds) done.
[ 131.480000] Suspending console(s) (use no_console_suspend to debug)
[ 131.490000] nuc970fb suspend
[ 131.510000] PM: suspend of devices complete after 30.000 msecs
[ 131.510000] PM: late suspend of devices complete after 0.001 msecs
[ 131.510000] PM: noirq suspend of devices complete after 0.001 msecs
[ 131.510000] clk source suspend
[ 131.510000] clk event suspend
[ 131.510000] clk event resume
[ 131.510000] clk source resume
[ 131.510000] PM: noirq resume of devices complete after 0.001 msecs
[ 131.510000] PM: early resume of devices complete after 0.001 msecs
[ 131.620000] nuc970fb resume
[ 131.620000] Warning, request gpio fail...
[ 131.620000] Warning, request gpio fail...
[ 131.620000] Warning, request gpio fail...
[ 131.830000] ST7789V LCD init done.
[ 131.830000] PM: resume of devices complete after 320.000 msecs
[ 131.900000] Restarting tasks ... done.
[ 252.380000] PM: Syncing filesystems ... done.
[ 252.390000] Freezing user space processes ... (elapsed 0.02 seconds) done.
[ 252.410000] Freezing remaining freezable tasks ... (elapsed 0.02 seconds) done.
[ 252.430000] Suspending console(s) (use no_console_suspend to debug)
[ 252.440000] nuc970fb suspend
[ 252.440000] PM: suspend of devices complete after 10.000 msecs
[ 252.440000] PM: late suspend of devices complete after 0.001 msecs
[ 252.440000] PM: noirq suspend of devices complete after 0.001 msecs
[ 252.440000] clk source suspend
[ 252.440000] clk event suspend
[ 252.440000] clk event resume
[ 252.440000] clk source resume
[ 252.440000] PM: noirq resume of devices complete after 0.001 msecs
[ 252.440000] PM: early resume of devices complete after 0.001 msecs
[ 252.550000] nuc970fb resume
[ 252.550000] Warning, request gpio fail...
[ 252.550000] Warning, request gpio fail...
[ 252.550000] Warning, request gpio fail...
[ 252.760000] ST7789V LCD init done.
[ 252.760000] PM: resume of devices complete after 320.000 msecs
[ 252.830000] Restarting tasks ... done.

-sh: root@HHT:#: not found
root@HHT:
#
root@HHT:#
root@HHT:
# [ 373.370000] PM: Syncing filesystems ... done.
[ 373.410000] Freezing user space processes ... (elapsed 0.02 seconds) done.
[ 373.430000] Freezing remaining freezable tasks ... (elapsed 0.02 seconds) done.
[ 373.450000] Suspending console(s) (use no_console_suspend to debug)

@junwushi
Copy link
Author

junwushi commented Jul 4, 2017

inittab file content

/etc/inittab: init(8) configuration.

$Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $

The default runlevel.

id:5:initdefault:

Boot-time system configuration/initialization script.

This is run first except when booting in emergency (-b) mode.

si::sysinit:/etc/init.d/rcS

What to do in single-user mode.

~~:S:wait:/sbin/sulogin

/etc/init.d executes the S and K scripts upon change

of runlevel.

Runlevel 0 is halt.

Runlevel 1 is single-user.

Runlevels 2-5 are multi-user.

Runlevel 6 is reboot.

l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6

Normally not reached, but fallthrough in case of emergency.

z6:6:respawn:/sbin/sulogin

/sbin/getty invocations for the runlevels.

The "id" field MUST be the same as the last

characters of the device (after "tty").

Format:

:::

0:123456:respawn:/sbin/getty 115200 ttyS0
1:123456:respawn:/sbin/getty 115200 ttyGS0

@yachen
Copy link

yachen commented Jul 4, 2017

I don't understand why did you post an inittab file here. This is not the file we included in our BSP.

@junwushi
Copy link
Author

junwushi commented Jul 4, 2017

1:123456:respawn:/sbin/getty 115200 ttyGS0
that means how to test the ttyGS0 working ok or not

yachen pushed a commit that referenced this issue Jul 17, 2017
commit 3d46a44a0c01b15d385ccaae24b56f619613c256 upstream.

PID: 614    TASK: ffff882a739da580  CPU: 3   COMMAND: "ocfs2dc"
  #0 [ffff882ecc3759b0] machine_kexec at ffffffff8103b35d
  #1 [ffff882ecc375a20] crash_kexec at ffffffff810b95b5
  #2 [ffff882ecc375af0] oops_end at ffffffff815091d8
  #3 [ffff882ecc375b20] die at ffffffff8101868b
  #4 [ffff882ecc375b50] do_trap at ffffffff81508bb0
  #5 [ffff882ecc375ba0] do_invalid_op at ffffffff810165e5
  #6 [ffff882ecc375c40] invalid_op at ffffffff815116fb
     [exception RIP: ocfs2_ci_checkpointed+208]
     RIP: ffffffffa0a7e940  RSP: ffff882ecc375cf0  RFLAGS: 00010002
     RAX: 0000000000000001  RBX: 000000000000654b  RCX: ffff8812dc83f1f8
     RDX: 00000000000017d9  RSI: ffff8812dc83f1f8  RDI: ffffffffa0b2c318
     RBP: ffff882ecc375d20   R8: ffff882ef6ecfa60   R9: ffff88301f272200
     R10: 0000000000000000  R11: 0000000000000000  R12: ffffffffffffffff
     R13: ffff8812dc83f4f0  R14: 0000000000000000  R15: ffff8812dc83f1f8
     ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
  #7 [ffff882ecc375d28] ocfs2_check_meta_downconvert at ffffffffa0a7edbd [ocfs2]
  #8 [ffff882ecc375d38] ocfs2_unblock_lock at ffffffffa0a84af8 [ocfs2]
  #9 [ffff882ecc375dc8] ocfs2_process_blocked_lock at ffffffffa0a85285 [ocfs2]
assert is tripped because the tran is not checkpointed and the lock level is PR.

Some time ago, chmod command had been executed. As result, the following call
chain left the inode cluster lock in PR state, latter on causing the assert.
system_call_fastpath
  -> my_chmod
   -> sys_chmod
    -> sys_fchmodat
     -> notify_change
      -> ocfs2_setattr
       -> posix_acl_chmod
        -> ocfs2_iop_set_acl
         -> ocfs2_set_acl
          -> ocfs2_acl_set_mode
Here is how.
1119 int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
1120 {
1247         ocfs2_inode_unlock(inode, 1); <<< WRONG thing to do.
..
1258         if (!status && attr->ia_valid & ATTR_MODE) {
1259                 status =  posix_acl_chmod(inode, inode->i_mode);

519 posix_acl_chmod(struct inode *inode, umode_t mode)
520 {
..
539         ret = inode->i_op->set_acl(inode, acl, ACL_TYPE_ACCESS);

287 int ocfs2_iop_set_acl(struct inode *inode, struct posix_acl *acl, ...
288 {
289         return ocfs2_set_acl(NULL, inode, NULL, type, acl, NULL, NULL);

224 int ocfs2_set_acl(handle_t *handle,
225                          struct inode *inode, ...
231 {
..
252                                 ret = ocfs2_acl_set_mode(inode, di_bh,
253                                                          handle, mode);

168 static int ocfs2_acl_set_mode(struct inode *inode, struct buffer_head ...
170 {
183         if (handle == NULL) {
                    >>> BUG: inode lock not held in ex at this point <<<
184                 handle = ocfs2_start_trans(OCFS2_SB(inode->i_sb),
185                                            OCFS2_INODE_UPDATE_CREDITS);

ocfs2_setattr.#1247 we unlock and at #1259 call posix_acl_chmod. When we reach
ocfs2_acl_set_mode.#181 and do trans, the inode cluster lock is not held in EX
mode (it should be). How this could have happended?

We are the lock master, were holding lock EX and have released it in
ocfs2_setattr.#1247.  Note that there are no holders of this lock at
this point.  Another node needs the lock in PR, and we downconvert from
EX to PR.  So the inode lock is PR when do the trans in
ocfs2_acl_set_mode.#184.  The trans stays in core (not flushed to disc).
Now another node want the lock in EX, downconvert thread gets kicked
(the one that tripped assert abovt), finds an unflushed trans but the
lock is not EX (it is PR).  If the lock was at EX, it would have flushed
the trans ocfs2_ci_checkpointed -> ocfs2_start_checkpoint before
downconverting (to NULL) for the request.

ocfs2_setattr must not drop inode lock ex in this code path.  If it
does, takes it again before the trans, say in ocfs2_set_acl, another
cluster node can get in between, execute another setattr, overwriting
the one in progress on this node, resulting in a mode acl size combo
that is a mix of the two.

Orabug: 20189959
Signed-off-by: Tariq Saeed <tariq.x.saeed@oracle.com>
Reviewed-by: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Joseph Qi <joseph.qi@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants